Web Development

Firefox 159 Enables CSS Scroll-Driven Animations by Default and Adds Developer Features

Mozilla's Firefox 159 turns on CSS scroll-driven animations by default and ships useful updates for Web Components, HTML sanitization, graphics APIs, and browser automation.

Firefox 159 browser release highlighting CSS scroll-driven animations for developers
Firefox 159 makes scroll-linked CSS animations available by default for web developers.

Firefox 159 is a developer-focused release with one headline change: CSS scroll-driven animations are now enabled by default. Instead of waiting for a clock, an animation can follow how far a user has scrolled.

That matters because many page effects—progress bars, fade-ins, parallax accents—are tied to scroll position. Until now, teams often reached for JavaScript. Firefox 159 makes the CSS route ready for everyday use in this browser, alongside other updates for custom elements, safer HTML parsing, WebGL, WebGPU, CSS Grid lanes, and WebDriver BiDi.

What is new in Firefox 159?

Mozilla's developer notes for Firefox 159 group the release into CSS, DOM APIs, graphics, and automation. The biggest day-to-day win for most frontend teams is scroll-driven animation support turning on by default. The other changes are smaller but useful if you build Web Components, sanitize untrusted HTML, write WebGL/WebGPU code, or drive Firefox with BiDi.

Firefox also lists some features that still ship disabled by default, such as exposing CSS numeric factory functions in workers and worklets. Those remain experimental until you flip the matching about:config preference. This article focuses on the confirmed, noteworthy shipping changes.

CSS scroll-driven animations are now enabled by default

Traditional CSS animations follow time. You write @keyframes, set a duration, and the browser moves from 0% to 100% as seconds pass.

Scroll-driven animations keep the same keyframes idea, but the timeline is scroll progress. When the user scrolls halfway through a container, the animation is about halfway done. Stop scrolling, and the animation pauses with you. See CodeToFun's guide to CSS scroll-driven animations and MDN's overview of scroll-driven animations.

For suitable effects, this can reduce JavaScript. You may not need a scroll listener, requestAnimationFrame loop, or animation library just to widen a progress bar. Libraries remain useful for complex sequencing, gesture physics, canvas work, or browsers that still lack support.

How CSS scroll-driven animations work

Two timeline types matter most:

  • Scroll progress timeline: progress is based on how far a scroll container has been scrolled.
  • View progress timeline: progress is based on an element moving through the visible area (the scrollport).

You connect an animation to a timeline with animation-timeline. Anonymous timelines can be created with the scroll() and view() functions. Named timelines can be declared with scroll-timeline and view-timeline.

animation-range lets you limit which part of that timeline drives the keyframes. For example, you can start the effect only after an element enters the viewport and finish before it leaves. On the JavaScript side, the related interfaces are ScrollTimeline and ViewTimeline.

Practical example: a reading progress bar

This example grows a thin bar across the top of the page as the document scrolls. It uses a scroll progress timeline on the root scroller.

/* Keyframes describe the visual change */
@keyframes grow-progress {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  transform-origin: left center;
  background: #2563eb;
  /* Link the animation to scroll progress of the root scroller */
  animation: grow-progress linear;
  animation-timeline: scroll(root block);
  animation-range: 0% 100%;
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  .progress {
    animation: none;
    transform: none;
  }
}

/* Older browsers without scroll-driven animations keep a static fallback */
@supports not (animation-timeline: scroll()) {
  .progress {
    animation: none;
    opacity: 0.35;
  }
}

Line by line:

  • @keyframes grow-progress scales the bar from empty to full.
  • animation: grow-progress linear attaches those keyframes with a steady mapping.
  • animation-timeline: scroll(root block) says progress comes from vertical scrolling of the page, not from time.
  • animation-range: 0% 100% uses the full scroll journey.
  • prefers-reduced-motion turns the effect off for users who ask for less motion. Pair that habit with your CSS media queries.
  • @supports not (animation-timeline: scroll()) gives older browsers a quiet fallback instead of a broken UI.

Use scroll-driven CSS when the effect is a direct map from scroll position to style. Keep JavaScript when you need multi-step choreography, physics, pointer-driven motion, or carefully shared state across many components.

Scoped custom element registries improve Web Component isolation

Custom elements let you invent HTML tags with JavaScript classes. The browser keeps their names in a CustomElementRegistry. Historically, that registry is global. If two libraries both try to define <my-button>, they collide.

Firefox 159 supports scoped custom element registries. A shadow tree can create an independent CustomElementRegistry whose definitions apply only to that DOM subtree. The CustomElementRegistry() constructor builds a scoped registry. The customElementRegistry property is available on Document, Element, and ShadowRoot.

For reusable Web Components, this is about isolation. A design system and a third-party widget can both ship a similarly named tag inside their own trees without fighting over one global name. That is especially helpful for large HTML apps assembled from many packages.

HTML Sanitizer API receives an important improvement

The HTML Sanitizer API helps clean untrusted markup before it becomes live DOM. Methods such as Element.setHTML() use it.

In Firefox 159, sanitization happens while the markup is parsed, not after a full unsafe tree is built and then trimmed. The final allowed content is meant to match the earlier approach, with two practical differences called out by Mozilla:

  • Neighboring text now lands in a single text node instead of being split across several nodes.
  • Because unwanted elements are removed during parsing, removed elements no longer run their custom element constructors.

That second point is a safety win. If dangerous or unwanted custom tags appear in untrusted HTML, their setup code should not execute just because the browser briefly built them before cleanup.

WebGL and WebGPU receive developer updates

WebGL extensions

Firefox 159 adds WebGL extensions on devices whose graphics drivers support them. They are not a promise that every GPU gets every extension.

  • EXT_clip_control: clipControlEXT() can move the clip origin toward the upper-left and use a 0 to 1 depth range instead of -1 to 1. That matches Direct3D and WebGPU conventions and helps reversed-Z techniques improve depth precision with floating-point depth buffers.
  • EXT_texture_mirror_clamp_to_edge: adds a wrapping mode that mirrors texture coordinates from -1 to 0 and clamps outside that range. A symmetric glow can be stored as half an image.
  • EXT_texture_norm16 for WebGL 2: enabled by default where drivers support 16-bit normalized formats, useful for higher-precision data such as elevation maps or medical images.

Teams working with canvas and low-level graphics should feature-detect these extensions before relying on them.

WebGPU limit reporting

GPUDevice.limits now reports adjusted values for maxStorageBuffersInFragmentStage, maxStorageBuffersInVertexStage, maxStorageTexturesInFragmentStage, and maxStorageTexturesInVertexStage. When a device is created, those limits are set from maxStorageBuffersPerShaderStage and maxStorageTexturesPerShaderStage. Previously, GPUDevice.limits could report the requested values instead of the adjusted ones. The change makes limit inspection more accurate for shader authors.

What happened to the legacy CSS masonry syntax?

Firefox 159 removes the experimental legacy masonry syntax: the masonry value of grid-template-columns and grid-template-rows, plus the masonry-auto-flow property.

Important context: that syntax was available by default only in Nightly, behind the layout.css.grid-template-masonry-value.enabled preference. It was not a widely deployed stable production feature that suddenly vanished from everyday Firefox. Mozilla says it is superseded by grid lanes layout, using the grid-lanes and inline-grid-lanes values of display. Review your Nightly experiments against current CSS Grid guidance before migrating demos.

WebDriver BiDi adds media feature emulation

For browser automation, Firefox 159 implements the WebDriver BiDi command emulation.setMediaFeaturesOverride. Clients can override CSS media features. In this release, support covers prefers-color-scheme, which helps tests confirm light and dark UI without manually flipping OS theme settings.

The same WebDriver notes also mention cleaner handling of recommended preferences, removal of the --remote-allow-system-access command-line flag in favor of the MOZ_REMOTE_ALLOW_SYSTEM_ACCESS environment variable, a polling memory-leak fix, and a machine-readable CDDL file for Firefox-specific BiDi extensions.

What It Means for Developers

What It Means for Frontend Developers

You can prototype scroll-linked UI with CSS first. Start with animation plus animation-timeline, then add motion preferences and @supports fallbacks. Keep measuring performance on long pages; cheap CSS is still work for the browser.

What It Means for Web Developers and UI Engineers

Progress indicators, sticky section accents, and reveal effects become easier to express declaratively. Design systems can document scroll timelines next to ordinary keyframe tokens. Accessibility reviews should still treat motion as optional.

What It Means for Web Component Developers

Scoped registries reduce package conflicts when multiple teams ship similarly named custom elements. Combine that with sanitizer improvements when components accept HTML from users or CMS fields.

What It Means for Full-Stack Developers

Server-rendered pages can ship scroll progress UI with less client JavaScript, which can help JavaScript budgets. Still gate advanced CSS on support checks so crawlers and older browsers get a usable fallback.

What It Means for Browser Automation Engineers

emulation.setMediaFeaturesOverride makes theme testing more deterministic in Firefox BiDi sessions. Update automation docs for the environment-variable change around system access, and re-check suites that previously depended on the removed command-line flag.

Bottom line

Firefox 159's centerpiece is practical: scroll-driven CSS animations are on by default. Around that, Mozilla improved component isolation, sanitizer safety, graphics APIs, Nightly masonry cleanup toward grid lanes, and BiDi theme emulation.

If you build modern web UI, try a small scroll progress or view-timeline effect in Firefox 159, protect users who prefer reduced motion, and keep fallbacks for browsers that are not there yet.

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author