Describe the bug
packages/shadcn/src/tailwind.css defines the shimmer utility twice, in two different ways:
- Via
@utility shimmer { ... }, which Tailwind compiles and correctly respects a configured prefix() (e.g. prefix(tw) → .tw\:shimmer).
- Via a hand-written, non-Tailwind selector at the bottom of the file that disables the animation for accessibility:
@media (prefers-reduced-motion: reduce) {
.shimmer {
animation: none;
background-image: none;
-webkit-text-fill-color: currentColor;
}
}
Because rule 2 is plain CSS and not generated through @utility, it is never rewritten by the prefixer. If a project configures a Tailwind prefix, the element actually renders with .tw\:shimmer (or whatever prefix is set), but the reduced-motion override still targets .shimmer and never matches. Result: prefers-reduced-motion: reduce silently stops disabling the shimmer animation for anyone using a prefix.
Reference:
|
@media (prefers-reduced-motion: reduce) { |
|
.shimmer { |
|
animation: none; |
|
background-image: none; |
|
-webkit-text-fill-color: currentColor; |
|
} |
Affected component/components
Shimmer
How to reproduce
- Configure a Tailwind v4 prefix, e.g.
@import "tailwindcss" prefix(tw);
- Apply
tw:shimmer to an element.
- Enable "reduce motion" in the OS/browser.
- The shimmer animation keeps running instead of being disabled — the generated class is
.tw\:shimmer, but the reduced-motion rule only targets the unprefixed .shimmer.
Suggested fix
Move the reduced-motion rule inside the existing @utility shimmer { ... } block (same pattern already used there for @variant dark { ... }) instead of as a separate hardcoded selector, so it's compiled by Tailwind and inherits the prefix automatically:
@utility shimmer {
...
@media (prefers-reduced-motion: reduce) {
animation: none;
background-image: none;
-webkit-text-fill-color: currentColor;
}
}
I've verified this reproduces against the pinned commit above and will open a PR with this fix.
Codesandbox/StackBlitz link
No response
Logs
System Info
Tailwind CSS v4, prefix() option configured
Before submitting
Describe the bug
packages/shadcn/src/tailwind.cssdefines theshimmerutility twice, in two different ways:@utility shimmer { ... }, which Tailwind compiles and correctly respects a configuredprefix()(e.g.prefix(tw)→.tw\:shimmer).Because rule 2 is plain CSS and not generated through
@utility, it is never rewritten by the prefixer. If a project configures a Tailwind prefix, the element actually renders with.tw\:shimmer(or whatever prefix is set), but the reduced-motion override still targets.shimmerand never matches. Result:prefers-reduced-motion: reducesilently stops disabling the shimmer animation for anyone using a prefix.Reference:
ui/packages/shadcn/src/tailwind.css
Lines 623 to 628 in cb2bcd8
Affected component/components
Shimmer
How to reproduce
@import "tailwindcss" prefix(tw);tw:shimmerto an element..tw\:shimmer, but the reduced-motion rule only targets the unprefixed.shimmer.Suggested fix
Move the reduced-motion rule inside the existing
@utility shimmer { ... }block (same pattern already used there for@variant dark { ... }) instead of as a separate hardcoded selector, so it's compiled by Tailwind and inherits the prefix automatically:I've verified this reproduces against the pinned commit above and will open a PR with this fix.
Codesandbox/StackBlitz link
No response
Logs
System Info
Tailwind CSS v4, prefix() option configuredBefore submitting