DEV Community

Discussion on: Stop Removing Focus

Collapse
 
pcjmfranken profile image
Peter Franken • Edited

Quite surprised to see no mention of the :focus-visible pseudo class considering it's been around for so long!

For anyone not familiar: it allows for focus indicators to only appear on keyboard navigation (like on tab) and not on elements that gained focus through a mouse interaction. Best of both worlds.

MDN: developer.mozilla.org/en-US/docs/W...
CSS-Tricks: css-tricks.com/keyboard-only-focus...
Official polyfill (yup, IE11 support for you enterprise devs!): github.com/WICG/focus-visible

Collapse
 
colabottles profile image
Todd Libby

Oversight on my part. Thanks for adding this.

Collapse
 
turbotobias profile image
Tobias Goulden Schultz • Edited

Thank you, I'd also argue that outline is noisy UX unless it's tabbed to (edit: because everything is a button, increasingly)