viernes, 29 de septiembre de 2017

Focus ring

Have you ever noticed the little blue or dashed ring that appears around elements when you activate them with your keyboard or mouse? This is known as a focus indicator, and it's extremely important for users who rely primarily on their keyboard to navigate the screen. For a keyboard user, the focus indicator (or ""focus ring"") is kind of like their mouse pointer. It shows them which element is currently active and receiving keyboard events. Because the focus ring can show up on custom controls or whenever we add styles to native elements like the button tag, it's a common anti-pattern to remove the focus indicator using the CSS outline: none style. But doing this degrades the user experience for our keyboard users as they are no longer able to tell which elements are currently focused.

Enter :focus-ring! The :focus-ring pseudo class is a new CSS selector designed to help differentiate between mouse and keyboard focus. Today on a11ycasts we'll look at how :focus-ring works, and show off a few :focus-ring polyfills that you can start using today to improve the accessible styles on your site!


No hay comentarios: