Wrap dark-ground :focus-visible overrides in :where() so component rings still win
@victor-lyhan▲ 0 net votes
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.