Read them from the browser#
Ask the reporter to run this on the page:
Object.fromEntries([
'(prefers-color-scheme: dark)', '(prefers-reduced-motion: reduce)', '(prefers-contrast: more)',
'(forced-colors: active)', '(prefers-reduced-transparency: reduce)', '(inverted-colors: inverted)',
].map(q => [q, matchMedia(q).matches]))
A browser that does not support a feature reports false. Note the browser with the result. MDN: Using media queries for accessibility
Also ask whether the site has its own theme setting, since an app setting can override, or fight with, the system preference.
Emulate them#
Playwright sets them per context or per page:
await page.emulateMedia({ colorScheme: 'dark', reducedMotion: 'reduce', forcedColors: 'active', contrast: 'more' });
We ran that in Chromium and the page's matchMedia returned true for all four queries. Playwright: page.emulateMedia()
In Chrome DevTools, the Rendering panel emulates prefers-color-scheme, prefers-reduced-motion, prefers-contrast, forced-colors and others for the open tab. Chrome DevTools: Rendering features
Bugs that hide behind each preference#
| Preference | Typical bug |
|---|---|
| Dark color scheme | Text in a color the theme did not override, an icon with a hard-coded fill, an image with a transparent background that disappears |
| Reduced motion | A script waits for transitionend or animationend, which never fires when the stylesheet removes the animation |
| Forced colors (Windows high contrast) | Backgrounds and box shadows removed, so a focus ring or a selected state made with them disappears; custom checkboxes vanish |
| More contrast | Styles that only exist for the default contrast, such as borders drawn with a near-background color |
The reduced motion row deserves attention because it breaks function, not only looks. A modal that removes itself on transitionend stays on screen forever when the transition is set to none.
Worked example: a toast that never closed#
This example is fictional. A user reports that the "Saved" toast never goes away and covers the page's Next button. Developers cannot reproduce it.
The user's media query check shows (prefers-reduced-motion: reduce): true. The site's stylesheet set transition: none for reduced motion, and the toast component removed itself in a transitionend handler after fading out. With no transition, no event fired. Emulating reducedMotion: 'reduce' in Playwright reproduced it on every run. The fix removed the toast after its timer whether or not a transition ran.
Questions#
Are these preferences sensitive?
They can reveal accessibility needs. Collect them for the reproduction, keep them with the bug, and do not log them as user attributes elsewhere.
Does forced colors emulation match Windows exactly?
It applies the forced colors behavior in Chromium. The actual palette comes from the user's Windows theme. If the bug depends on particular colors, ask for a screenshot as well.
Do these apply to emails and PDFs generated by the app?
Not through the browser. They are rendered elsewhere, with that client's own settings.
Return to reproducing what someone else saw for the other layers a replay needs.