Polyfill for :focus-visible pseudo-selector
npm install focus-visible
Based on the proposed CSS:focus-visible
pseudo-selector,
this prototype adds a focus-visible class to the focused element,
in situations in which the :focus-visible pseudo-selector should match.
- Read the Explainer.
- Read the Spec.
- Try the Demo.
- Give feedback!
- Open discussions:
- What's the impact on users with low vision or cognitive impairments?
- Should :focus-visible match when returning focus or programmatically focusing?
- Brainstorm: options for opting in to always matching focus ring.
š :focus-visible is now supported in all major browsers.
We would encourage you to use the CSS selector instead of this polyfill if you are able. We are not currently planning to make any updates or release new versions of the polyfill, but are open to discussion in GitHub issues if changes need to be made for emergencies.
npm install --save focus-visible
_We recommend only using versions of the polyfill that have been published to npm, rather than
cloning the repo and using the source directly. This helps ensure the version you're using is stable
and thoroughly tested._
_If you do want to build from source, make sure you clone the latest tag!_
``html
...