Imagine using a website where the cursor is invisible. You can click, but you can never tell what is selected. That is what an interface feels like to a keyboard user when focus states are missing or hidden.
A focus state is the visual signal that tells people which element is ready to receive input. It is small, easy to overlook and essential. This guide explains what focus states are, how to design them well, and which mistakes make interfaces hard or impossible to use.
What Is a Focus State?
A focus state is the visual appearance of an interactive element when it is the current target for keyboard or assistive technology input. When someone presses Tab, the browser moves focus to the next link, button or form field, and the interface should show that change clearly.
Focus differs from related states:
- Hover: a mouse pointer is over the element
- Active: the element is being pressed
- Selected or current: the element represents the current page, tab or choice
- Focus: the element will receive the next keystroke
These states can overlap. A button can be hovered, focused and active at once, so each needs a distinct, compatible style.
Why Focus States Matter
- They enable keyboard navigation. Without a visible indicator, people lose their place and cannot predict what Enter or Space will do.
- They support many users. Keyboard users include people with motor impairments, screen reader users, people using switch devices and power users who prefer speed.
- They are a legal and standards requirement. WCAG requires a visible keyboard focus indicator, and many accessibility laws build on it.
- They reduce errors. Clear focus helps everyone avoid typing into the wrong field, especially in long forms.
For the bigger picture, read our guide to inclusivity and accessibility in experience design.
What the Standards Say
Several WCAG success criteria apply to focus:
- 2.4.7 Focus Visible (Level AA): any keyboard-operable interface must have a visible focus indicator.
- 1.4.11 Non-text Contrast (Level AA): the focus indicator must have at least a 3:1 contrast ratio against adjacent colors.
- 2.4.11 Focus Not Obscured, Minimum (Level AA, WCAG 2.2): a focused element must not be entirely hidden by sticky headers, cookie banners or chat widgets.
- 2.4.13 Focus Appearance (Level AAA, WCAG 2.2): sets stricter expectations for the size and contrast of the indicator. It is not required for AA, but it is a useful design target.
The practical takeaway: the indicator must be visible, high contrast and never covered.
Best Practices for Focus State Design
1. Never remove the focus outline without a replacement
The most common accessibility failure is a stylesheet rule that removes the default outline because it looks “ugly.” Browsers provide a default for a reason. If you replace it, the new style must be at least as visible. Removing it with nothing in its place makes keyboard navigation guesswork.
2. Make the indicator highly visible
A good focus indicator is easy to see without searching. Aim for:
- A solid outline or ring, commonly 2 to 3 pixels thick
- An offset of a few pixels so the ring does not merge with the element’s border
- At least 3:1 contrast against both the element and the background
- A shape that follows the element, including rounded corners
A subtle color shift or a faint shadow is rarely enough, especially for users with low vision.
3. Use :focus-visible thoughtfully
The :focus-visible pseudo-class shows focus styles when the browser decides keyboard-style focus is appropriate, such as after pressing Tab, and hides them for most mouse clicks on buttons. This avoids the visual noise that led many teams to remove outlines in the first place, while still protecting keyboard users. Text inputs always show focus, because users type into them regardless of input method.
4. Keep the style consistent
Define a single, recognizable focus treatment and apply it across the product. Consistency lets users build a mental model: “the blue ring means I am here.” Store it as a design token in your design system and component library, so every component inherits it automatically.
5. Make it work on every background
A blue ring that is clear on white may disappear on a dark header, an image or a colored button. Test focus on every surface. Common solutions include:
- Two-tone rings, such as a light inner ring with a dark outer ring, which stay visible on any background
- Theme-aware tokens that switch color in dark mode
- Inset or offset outlines that avoid clipping by containers with overflow hidden
6. Do not rely on color alone
Changing only the text color, or only a hue, will fail for people with color vision deficiencies. Combine color with a shape change, such as an outline, underline, thickened border or background fill. The same principle applies throughout good visual hierarchy: important signals should be perceivable in more than one way.
7. Keep focus unobstructed and uncropped
Sticky headers, floating action buttons and cookie banners can cover the element that just received focus, so the user is tabbing blindly. Use scroll padding or scroll margin so focused elements scroll into clear view. Check that containers do not clip outlines, and test with every overlay active.
8. Support logical focus order
A beautiful indicator is useless if focus jumps around unpredictably. Follow the visual and reading order, avoid positive tabindex values and make sure hidden or off-screen elements are not focusable. Order problems often trace back to poor information architecture, where the structure was never organized before it was styled.
9. Style every interactive component
Focus states are needed on:
- Links, buttons and icon buttons
- Form fields, checkboxes, radio buttons and toggles
- Tabs, menu items, accordions and cards that act as links
- Custom controls such as sliders, date pickers and dropdowns
- Skip links, which should appear visibly when focused
Custom components built from generic elements are especially prone to missing focus, because they are not focusable by default.
10. Make focus feel designed, not default
Focus does not have to look clinical. Brand-aligned colors, rounded rings that echo your corner radius and subtle transitions can make focus feel part of the system. Keep animation brief and respect reduced-motion preferences. Thoughtful micro-interactions add polish, as long as visibility comes first.
11. Manage focus when the interface changes
Visible style is only half the picture. When content changes, focus must move sensibly:
- Opening a modal: move focus inside, contain it while open, and return it to the trigger on close
- Navigating in a single-page app: move focus to the new heading or main region
- Removing an item: place focus on a logical neighbor, not the top of the page
- Showing an error summary: move focus to it so it is noticed
Users should never be left with focus that has disappeared.
Examples of Strong Focus States
A two-tone ring. A white inner ring and a dark blue outer ring around buttons, visible on light and dark backgrounds alike.
An input with border and shadow. A thicker, high-contrast border with a soft glow when a text field receives focus, giving a clear shape change, not only a color change.
A card link. A full card wrapped in an outline when focused, so users can see the entire clickable area.
A skip link. Hidden off-screen until focused, then displayed in a high-contrast box at the top of the page.
Common Focus State Mistakes
- Removing outlines globally with outline: none and no replacement
- Low-contrast indicators, such as light grey on white
- Relying on color change alone
- Focus styles that vanish on certain backgrounds, especially in dark mode or on images
- Rings clipped by overflow rules or hidden behind neighboring elements
- Focused elements covered by sticky headers or banners
- Inconsistent styles that make users relearn the cue in each section
- Illogical tab order and focusable elements that are off-screen
- Custom components without keyboard focus
- Focus lost after modals, deletions or route changes
- Overly decorative or animated focus effects that distract more than they help
- Never testing with a keyboard
How to Test Focus States
- Put the mouse aside and navigate each page using only Tab, Shift + Tab, Enter, Space, arrow keys and Escape.
- Check every interactive element for a visible, high-contrast indicator.
- Test on all backgrounds, including dark mode, images and colored sections.
- Zoom to 200 percent and check for cropping or overlap.
- Open overlays and sticky elements to confirm focus is never fully hidden.
- Measure contrast of the indicator against adjacent colors with a contrast checker.
- Add automated checks such as axe or Lighthouse, but remember they cannot judge whether an indicator is genuinely clear.
- Include keyboard and assistive technology users in research. A structured approach to usability testing and feedback loops makes this routine.
A Quick Checklist
- Does every interactive element show a visible focus state?
- Is the indicator at least 3:1 contrast, and clear on every background?
- Does it use more than color alone?
- Is it consistent, tokenized and used across components?
- Is focus never obscured, clipped or lost?
- Is tab order logical, with a working skip link?
- Has it been tested with a keyboard and real users?
Bringing It All Together
Focus states are one of the smallest details in an interface and one of the most important. They tell keyboard users where they are, what they can do and what will happen next. A strong focus style is visible, consistent, high contrast and built into your components from the start, not patched in at the end.
Test your own product this week with the mouse unplugged. Wherever you lose track of where you are, you have found a fix worth making.
If you want help building accessible, consistent interfaces, work with a trusted UI UX design company in Bangalore that can help you design, test and refine experiences that work for every user.