Skip to main content

Posts

Showing posts from January, 2026

Scroll-Driven Animations: Debugging `scroll()` Scope and Stacking Contexts

  You have crafted a perfect parallax hero section. You attach   animation-timeline: scroll()   to your elements, expecting them to translate smoothly as the user descends the page. Instead, the elements remain static, or worse, they animate based on the wrong container—jittering inside a small overflow wrapper instead of flowing with the viewport. The CSS Scroll-Driven Animations API is powerful, but its reliance on DOM hierarchy and implicit scroll containers creates significant "silent failures." The browser doesn't throw an error; the timeline simply never progresses. This post dissects why  scroll()  fails in complex layouts and implements the solution using  Named Timelines  and  Timeline Scope Hoisting . The Root Cause: Implicit Scoping and the  nearest  Trap By default, writing  animation-timeline: scroll()  is shorthand for  animation-timeline: scroll(nearest block) . When the browser parses this, it traverses up ...

The `inert` Attribute vs. `aria-hidden`: Managing Focus in Animated Drawers

  One of the most persistent accessibility violations in modern single-page applications occurs during the transition states of off-canvas menus (drawers). We build performant, 60fps animations using CSS transforms to slide a drawer into the viewport. Visually, the drawer covers the main content. However, unless the DOM is explicitly managed, the "background" content remains interactive. Keyboard users can Tab completely out of the drawer and interact with invisible links, forms, and buttons underneath the backdrop. Historically, developers relied on  aria-hidden="true"  or complex "focus trap" JavaScript loops to mitigate this. Both approaches are flawed. This post details why  aria-hidden  is insufficient for interaction management and how the  inert  attribute provides the browser-native solution. The Root Cause: The Disconnect Between Accessibility and Focus To understand why the common fixes fail, we must distinguish between the  Accessibilit...