[bug]: scroll-fade always fades in Firefox, including containers with no overflow
[!NOTE] Fix submitted in #11298.
Since scroll-fade shipped in #11022 (18fcf0f, 26 Jun 2026), every scroll-fade element renders a permanent fade in Firefox, including containers that do not overflow. This affects the shadcn docs site itself: the sidebar, the "On This Page" nav, and MDX tables are all faded at their edges on every page.
The "No Overflow, No Fade" example in Firefox. The list does not scroll, and both edges are masked anyway.
The same on another docs page: table edges and the "On This Page" navRoot cause. All nine scroll-fade utilities in packages/shadcn/src/tailwind.css gate the scroll-aware behavior on @supports (animation-timeline: scroll()), and the @supports not branch applies the fade unconditionally:
@supports not (animation-timeline: scroll()) {
--scroll-fade-t: var(--_scroll-fade-size-t);
--scroll-fade-b: var(--_scroll-fade-size-b);
}Firefox has not shipped scroll-driven animations. The API is still behind layout.css.scroll-driven-animations.enabled, which defaults to false in release (bug 1324602, tracked for Interop 2026). So Firefox always takes the fallback branch, and the fade is applied to both edges of every scroll-fade element regardless of whether it scrolls.
I verified in Firefox 153 (macOS 26.3.1, Apple Silicon) that this is exactly the switch. With the pref flipped to true, CSS.supports("animation-timeline: scroll()") returns true and every case renders correctly:
CSS.supports("animation-timeline: scroll()") |
non-overflowing scroll-fade |
|
|---|---|---|
| Chrome 149 | true |
crisp ✅ |
| Safari 26.3.1 | true |
crisp ✅ |
| Firefox 153 | false |
faded ❌ |
| Firefox 153 + pref on | true |
crisp ✅ |
This contradicts the documented guarantee in scroll-fade.mdx:
If the content does not overflow, no fade is shown. You can apply
scroll-fadeto any list without checking whether it scrolls.
The "Fallback" section does say the fallback is "a static fade on both edges", but in practice that turns the utility into a permanent mask on non-scrollable content: it dissolves the first and last rows of short lists, clips table text, and washes out the docs sidebar. A false affordance is worse than none, because it tells the user there is more content when there isn't.
Two secondary symptoms of the same fallback, also visible in Firefox:
- It fades both edges permanently, so even genuinely scrollable containers show a top fade at
scrollTop: 0and a bottom fade at the end. That is the opposite of the documented "at rest, the top edge is crisp". - Fixed sizes compound it:
scroll-fade-24on a short list masks ~96px of a ~110px container, making the content nearly unreadable.
Suggested fix
Submitted as #11298 and verified against Firefox 153, Chrome 149 and Safari 26.3.1. Besides the patch below, it rewrites the Fallback section of scroll-fade.mdx (the current wording promises a static fade on both edges, which the fix makes inaccurate) and adds a changeset.
The fallback can be made fully scroll-aware in Firefox by reading the overflow distances that Base UI's ScrollArea.Viewport already publishes: --scroll-area-overflow-y-start / -y-end / -x-start / -x-end, documented as "the distance from the … edge in pixels". This is the approach coss.com/ui uses, and it works correctly in Firefox today.
Clamping the fade to that distance is a one-line change per @supports not block:
@supports not (animation-timeline: scroll()) {
- --scroll-fade-t: var(--_scroll-fade-size-t);
- --scroll-fade-b: var(--_scroll-fade-size-b);
+ --scroll-fade-t: min(
+ var(--_scroll-fade-size-t),
+ var(--scroll-area-overflow-y-start, 0px)
+ );
+ --scroll-fade-b: min(
+ var(--_scroll-fade-size-b),
+ var(--scroll-area-overflow-y-end, 0px)
+ );
}That single expression covers both cases:
- Inside a
ScrollArea(the Base UI variant, which is already a dependency) the variables exist, so the fade tracks the scroll position exactly as it does in Chrome: crisp at the start, fading at the end, nothing at all on a list that doesn't overflow. - On a bare scroll container the variables are absent, so the fallback resolves to
min(size, 0px)→0px→ no fade. Safe degradation instead of a false affordance.
To be clear about how far that goes: the bug affects all three bases equally, since the utility ships in the shared shadcn package, but only Base UI's ScrollArea.Viewport publishes the overflow variables. Radix's ScrollArea exposes only --radix-scroll-area-{corner,thumb}-*, the React Aria variant is a plain <div> with overflow-auto, and every scroll-fade example in the docs is a bare <div> rather than a ScrollArea. So this removes the false fade everywhere and restores the real one only on the Base UI ScrollArea path. Bringing the other bases to parity would mean publishing the same two variables from a small shared helper, which trades away "no JavaScript and no scroll listeners". That seems like your call rather than something to assume.
There is no CSS-only alternative. Firefox 153 implements none of the scroll-driven-animation surface (scroll-timeline-name, view-timeline, timeline-scope, animation-range, container-type: scroll-state), and mask-attachment, which would let the classic background-attachment: local shadow trick be expressed as a mask, is unimplemented in every engine. A measured value from the component is the only way to know whether content overflows.
Every change lives inside @supports not (animation-timeline: scroll()), which Chrome and Safari never evaluate, so supporting engines are untouched.
Related: #11185 reports the table symptom of this ("inner shadows … cutting off the text", also filed from Firefox), and #11187 removes scrollbar-none from the table wrapper but deliberately keeps scroll-fade-x, so it does not address the fade.
Affected component/components
scroll-fade utility (scroll-fade, scroll-fade-x, scroll-fade-{t,b,l,r,s,e}), plus ScrollArea, MessageScroller, Table
How to reproduce
- Open the reproduction link below in Firefox. The banner reads "BUG REPRODUCED" and all four boxes are masked at their edges. Open the same link in Chrome or Safari: the banner reads "OK" and only the genuinely scrollable box fades.
- Or reproduce it on the docs directly. Open https://ui.shadcn.com/docs/utils/scroll-fade in Firefox and look at the "No Overflow, No Fade" example. The three-item list is faded top and bottom even though it does not scroll.
- On the same page in Firefox, note that the docs sidebar and the "On This Page" nav are faded at their edges too. The table at https://ui.shadcn.com/docs/typeset#prior-art shows the same thing.
- Open about:config, set layout.css.scroll-driven-animations.enabled to true, then reload. Every fade now behaves as documented. This is the switch the fallback hinges on.
- Chrome and Safari are unaffected at every step.
Codesandbox/StackBlitz link
https://stackblitz.com/edit/shadcn-scroll-fade-firefox
Logs
--- Firefox 153.0 ---
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:153.0) Gecko/20100101 Firefox/153.0
CSS.supports("animation-timeline: scroll()") = false
box 1 (no overflow) --scroll-fade-t = min(12%, 40px)
box 1 (no overflow) --scroll-fade-b = min(12%, 40px)
BUG REPRODUCED. A non-overflowing container is being masked.
--- Chrome 149 ---
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36
CSS.supports("animation-timeline: scroll()") = true
box 1 (no overflow) --scroll-fade-t = 0px
box 1 (no overflow) --scroll-fade-b = 0px
OK. No fade on non-overflowing content.
--- Safari 26.3.1 ---
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.3.1 Safari/605.1.15
CSS.supports("animation-timeline: scroll()") = true
box 1 (no overflow) --scroll-fade-t = 0px
box 1 (no overflow) --scroll-fade-b = 0px
OK. No fade on non-overflowing content.System Info
macOS 26.3.1, Apple Silicon
Firefox 153.0 reproduced
Chrome 149.0.0.0 not affected
Safari 26.3.1 not affected
shadcn 4.14.1, tailwindcss 4.3.3
(the versions used to build the CSS inlined in the reproduction)Before submitting
- I've made research efforts and searched the documentation
- I've searched for existing issues
Source: shadcn-ui/ui