Sub topic 9
Making Focus Visible
Prerequisites
Assume you understand basic wireframes, common controls such as links and buttons, and the relationship between HTML and CSS. You should also have a logical keyboard order for the page. A focus indicator cannot help if focus moves through the interface in a confusing sequence.
Focus is not hover
Focus identifies the control that will receive keyboard input. A keyboard user presses Tab to move focus between interactive elements, then presses Enter or Space to activate a control. Hover only describes where a pointer is located. It is not available to someone using a keyboard, touch device, voice control, or switch access.
In a wireframe, mark the focused state for every interactive component:
- Links and buttons show a visible outline or ring.
- Form fields show which field is active.
- Menus show the currently focused item.
- Dialogs show where focus starts and where it returns after closing.
- Disabled controls do not receive focus unless the design has a specific reason.
A focus indicator must not depend on color alone. Use a boundary, change in thickness, underline, or another shape that remains visible against nearby colors.
Specify a reliable focus style
A practical baseline is a solid outline with enough thickness and spacing to remain visible around the entire control. The :focus-visible pseudo-class lets browsers show a focus style when interaction is likely to be keyboard-based.
:focus-visible {
outline: 3px solid #005fcc;
outline-offset: 2px;
}
button,
a,
input,
select,
textarea,
[role="button"] {
min-height: 24px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
outline: 3px solid #005fcc;
outline-offset: 2px;
}Do not replace this with outline: none unless you provide an equally clear alternative. Test the indicator against every background behind the component, including images, cards, footers, and selected states.
WCAG 2.2 includes requirements for visible focus, focus appearance, and focus not being obscured. The exact result depends on the control and its surrounding colors. In practice, make the indicator clearly different from both the unfocused control and the background. Keep it visible when a sticky header, cookie banner, or scrolling panel overlaps the focused element.
Annotate the wireframe
Add a focus note beside each interactive pattern. For example:
- “Keyboard focus uses a 3 px blue outline with 2 px offset.”
- “The focused menu item keeps its text label and adds an outline; color is not the only cue.”
- “When the dialog opens, focus moves to its heading or first useful control.”
- “When the dialog closes, focus returns to the button that opened it.”
The diagram below shows a simple focus path. It includes only interactive elements, not every visual object.
Check the design early
Run through the wireframe using only Tab, Shift+Tab, Enter, Space, and Escape. Ask whether the focused item is always visible, whether the order matches the reading order, and whether any focus ring disappears into its background. Zoom the page and test narrow layouts. A ring that is visible on a wide desktop screen may be clipped in a small viewport.
Exercise
A button changes from gray to blue when focused, but its border and shape do not change. Is this sufficient?
Show answer
Not necessarily. The color change must meet contrast requirements against the surrounding colors and the unfocused state. Add a clear outline or another non-color cue, then test it in every context.