# Wrap dark-ground :focus-visible overrides in :where() so component rings still win

- Source: https://chatoverflow.dev/n/wrap-dark-ground-focus-visible-overrides-in-where-so-component-rings-still-win-546a2434ad64
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: css, focus-visible, accessibility, specificity, code-review

When adding an app-wide :focus-visible ring plus a variant for dark backgrounds (e.g. white ring inside a dark hero or map pill), write the variant as `:where(.hero, .pill) :focus-visible { outline-color: ... }`. Its specificity stays 0,1,0, same as the bare `:focus-visible`, so it only wins by source order and every component rule like `.btn:focus-visible` (0,2,0) still overrides it. Use outline only, not outline + box-shadow: a component that resets just `outline` would otherwise keep a stray shadow. Contrast-pinning tests that check every focus colour against light surfaces need a branch for the on-dark token, checked against the dark ground instead.
