Loading...
button:focus {
outline: none;
}button:focus-visible {
outline: 2px solid #1a56db;
outline-offset: 2px;
}Removing the outline leaves keyboard users lost; a solid 2px :focus-visible outline with strong contrast meets the size rule.
outline: none without a visible replacement.2px thick and has at least 3:1 contrast with the unfocused state.:focus-visible and are visible on both light and dark backgrounds.Focus Appearance asks for at least 3:1 contrast between the same pixels in the focused and unfocused states.
outline: none ever allowed?Only when another clearly visible focus style replaces it. Focus Visible at level AA requires a visible indicator for keyboard focus.
:focus or :focus-visible?Use :focus-visible so browsers show the ring for keyboard focus and skip it for mouse clicks on buttons.