CSS scroll-state(): Accessibility Implications for Development Teams
Marcus · AI Research Engine
Analytical lens: Operational Capacity
Digital accessibility, WCAG, web development
AI-assisted · Source-linked · Editorially reviewed · Methodology
Trust note
This article was drafted with AI assistance, reviewed against accessibility.chat editorial standards, and should be treated as research and education rather than legal advice. We prioritize primary sources and correct material errors.

You're a front-end developer. You've just replaced a JavaScript scroll listener with four lines of CSS. Your bundle shrinks, your Lighthouse score improves, and your tech lead is happy. But your screen reader users? They might be in exactly the same position they were before — or worse, in a subtly more confusing one.
That's the quiet tension inside CSS scroll-state() (opens in new window), a new CSS container query feature that lets stylesheets respond directly to scroll behavior. It's genuinely useful. It's also a good example of how a technically elegant solution can carry accessibility debt if teams don't think carefully about what they're building.
What scroll-state() Actually Does
Despite its function-like appearance, scroll-state() is a container query — specifically, it extends the @container rule with scroll-aware conditions. The syntax looks like this:
@container scroll-state(<scroll-state-feature>: <value>) { /* styles */}The feature has four query types: scrolled (which direction was the most recent scroll), scrollable (whether overflow exists in a given direction), stuck (whether a sticky-positioned element has engaged), and snapped (whether a scroll-snap target is currently active).
Each of these maps to real UI patterns that previously required JavaScript event listeners. A sticky navigation bar that changes appearance when it sticks. A "back to top" link that slides in after the user scrolls down. A scroll indicator that disappears when the user reaches the bottom. The CSS Tricks reference implementation shows exactly this — a .toplink element with a translate: 0 200px default that animates to translate: 0 0 when scroll-state(scrolled: block-end) becomes true.
This is real capability. The question is what it means in practice for users who don't experience scroll the way sighted mouse users do.
The Four Features, Mapped to Accessibility Risk
Not all four scroll-state() features carry equal accessibility weight. Here's an honest breakdown:
| Feature | What It Detects | Primary Accessibility Concern | WCAG Relevance |
|---|---|---|---|
scrolled | Most recent scroll direction | Visual-only affordances triggered by scroll | WCAG 1.3.1 Info and Relationships (opens in new window), 2.4.3 Focus Order (opens in new window) |
scrollable | Whether overflow exists in a direction | Hidden content not surfaced to AT | WCAG 1.3.1 (opens in new window), 4.1.2 Name, Role, Value (opens in new window) |
stuck | Whether sticky positioning has engaged | Style changes not communicated to screen readers | WCAG 4.1.3 Status Messages (opens in new window) |
snapped | Whether a snap target is active | Active state not programmatically determinable | WCAG 1.3.1 (opens in new window), 4.1.2 (opens in new window) |
The pattern across all four: CSS is changing visual presentation in response to scroll state, but that state change is invisible to the accessibility tree unless you do additional work.
The "Back to Top" Problem Is Older Than This Feature
The canonical scroll-state() demo — a "back to top" link that slides in from below — is a useful illustration of the broader issue. The CSS implementation is cleaner than the JavaScript equivalent. But the accessibility question isn't about the implementation. It's about the pattern itself.
A "back to top" link that appears only after scrolling creates a focus order problem. When a keyboard user navigates sequentially through a page, a link that didn't exist at the top of the DOM but appears visually at the bottom can create confusion about where focus lands. WCAG 2.4.3 Focus Order (opens in new window) requires that focus order preserve meaning and operability — and dynamically revealed elements can violate this if they're not handled carefully.
The CSS Tricks example uses translate to visually hide and reveal the element, which means the element is always in the DOM. That's actually better than display: none for some purposes — but it also means a screen reader or keyboard user can encounter the link before it's visually visible, which is its own category of confusion.
This isn't a reason to avoid scroll-state(). It's a reason to think about the full interaction model, not just the visual one.
The sticky Navigation Pattern Deserves Scrutiny
The stuck feature is where things get interesting from an operational capacity standpoint. Sticky navigation is everywhere. Developers use it constantly. And scroll-state(stuck: top) gives a clean CSS-native way to change a nav's appearance when it engages.
The accessibility problem: when a sticky header changes its visual appearance (shrinks, changes color, drops a shadow), that change communicates something to sighted users — "you've scrolled past the top, you're now in navigation mode" — but communicates nothing to screen reader users. Under WCAG 4.1.3 Status Messages (opens in new window), status changes that matter to users should be programmatically exposed. A purely CSS-driven state change doesn't do that.
The fix isn't complicated: if the sticky state change carries semantic meaning (not just aesthetic), an aria-live region or appropriate ARIA attribute update via a small JavaScript observer can bridge the gap. The point is that scroll-state() alone doesn't get you there.
What Automated Testing Will and Won't Catch
Here's where teams need to be clear-eyed. Automated accessibility testing tools will not catch most scroll-state() issues. The problems are contextual — they emerge from the interaction between scroll behavior, DOM position, and user navigation patterns. That's exactly the category of issue that research on automated testing methodology identifies as systematically underdetected, with automated tools catching at most 37% of real accessibility barriers in comprehensive audits.
scroll-state() patterns will likely fall into that 63% gap. An automated scan will see the DOM, check color contrast on the visible state, and move on. It won't simulate scroll, evaluate focus order across state transitions, or assess whether a dynamically revealed element is operable by keyboard before it's visually present.
This has direct implications for organizational capacity. Teams that rely on automated scanning as their primary testing method — which is common, especially in resource-constrained environments — will ship scroll-state() implementations without understanding their accessibility profile. The compliance framework research we've published shows this pattern repeating: technically compliant at the automated level, functionally inaccessible in practice.
The Writing-Mode Dimension
One genuinely useful aspect of scroll-state() that the CSS Tricks reference highlights: the logical property values (block-start, block-end, inline-start, inline-end) respond to writing-mode. This matters for internationalization — a site translated to Arabic or Hebrew, which reads right-to-left, will have its scroll indicators and directional affordances automatically reorient.
This is actually an accessibility win. Users of right-to-left languages have historically encountered scroll-dependent UI that was hard-coded for left-to-right assumptions. Logical property support in scroll-state() reduces that burden without requiring additional JavaScript logic. It's the kind of detail that doesn't show up in WCAG audits but matters enormously to real users.
A Practical Implementation Checklist
For teams building with scroll-state() today, here's what operational readiness actually looks like:
Before shipping any scroll-state pattern:
- Confirm the element is always in the DOM (not injected on scroll). Use
translateoropacityfor visual hiding, notdisplay: nonepaired with scroll events. - Test keyboard navigation through the full scroll range. Tab through the page at top, middle, and bottom positions. Verify focus order makes sense at each state.
- For
stucknavigation changes that carry semantic meaning, add a JavaScript observer to update ARIA attributes or trigger anaria-liveannouncement. - For
snappedcarousels or galleries, ensure the active snap target has appropriatearia-currentor equivalent programmatic state. - Test with a screen reader (NVDA + Firefox, JAWS + Chrome, VoiceOver + Safari) — not just a keyboard. State transitions that are invisible to the accessibility tree will surface immediately.
Browser support reality check: As of mid-2025, scroll-state() has limited browser support. This means progressive enhancement isn't optional — it's the default. Your baseline experience must work without scroll-state(), which conveniently also means it must work for assistive technology users on non-supporting browsers.
The Honest Bottom Line
It's 2025, and the web platform is finally giving developers native tools to replace scroll-event JavaScript spaghetti. scroll-state() is part of that arc, and it's genuinely useful. But the accessibility community has watched too many "JavaScript replaced by CSS" announcements treat the elimination of JavaScript as the end of the accessibility conversation, when it's really just a different starting point.
The WCAG standards at w3.org (opens in new window) don't care whether your scroll behavior is driven by CSS or JavaScript. They care whether users — all users — can perceive, operate, and understand what's on the screen. scroll-state() shifts the implementation layer. It doesn't shift that obligation.
Build with it. Test it with real assistive technology. Don't let the elegance of the CSS obscure the complexity of the interaction.
About the Marcus lens
An operational lens on digital accessibility. Frames findings around what implementation and maintenance actually require — WCAG conformance, engineering effort, and day-to-day web development practice.
Marcus is an AI analyst lens, not a human staff member. It helps frame this article through a consistent accessibility perspective.
Specialization: Digital accessibility, WCAG, web development
View all articles using this lens →Primary source reviewed: https://css-tricks.com/almanac/functions/s/scroll-state/ (opens in new window)
Transparency Disclosure
This article was drafted with AI assistance and reviewed against our editorial methodology. We disclose that process so readers can judge the work clearly.