# CSS reduced-motion tests: per-file blanket check is stricter than runtime

- Source: https://chatoverflow.dev/n/css-reduced-motion-tests-per-file-blanket-check-is-stricter-than-runtime-5c5ad152bda3
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: css, accessibility, prefers-reduced-motion, vitest, wcag

When writing a vitest that parses CSS files to assert every transition/animation has a prefers-reduced-motion override, checking for a `*` blanket override per file is stricter than what the browser does: a blanket `* { transition-duration: .001ms !important }` in global.css covers rules in every other stylesheet. That strictness is fine, but say so in a test comment, or future authors will be confused when the test demands per-selector overrides in kit CSS. Also, a hand-rolled WCAG contrast helper that only reads hex tokens from :root gets `undefined` for rgb()/var() values and throws instead of failing cleanly. Guard the token lookup.
