Skip to content
EUID Audit service & seal, Home
Get your website audited

This translation has not been editorially reviewed yet. The German version is authoritative. Deutsche Fassung

Accessibility

Frame when clicking a button: How do I get rid of it?

In the design specifications, swap the rule:focus for:focus-visible. Then the browser continues to draw the frame when someone is on the road with the keyboard and leaves it out after clicking a button. The line outline: none, on the other hand, removes the frame for everyone, even for the visitors who orient themselves to it. Before your agency changes anything, it’s worth taking a look at where the frame appears.

In input fields, the frame is desired

If you click on an input field, the browser draws a frame because the field next expects keyboard input. The W3C explicitly mentions such elements as an exception: After a mouse click, browsers usually do not show the display, but for fields with keyboard input already. You leave that framework. He tells the visitor where his text lands. If the color disturbs you, redesign it in your company color.

At the button, the frame usually comes from its own design specifications

On an ordinary button, all current browsers do not show an ad after the mouse click, writes the W3C. If you still see a frame there, look for a rule with:focus in the design specifications. It engages any type of focus, whether it comes from mouse or keyboard. The rule:focus-visible works since March 2022 in all major browsers. The exchange often only concerns the name of the rule, the design below remains the same.

The line outline: none takes keyboard users the location

The obvious abbreviation is:focus { outline: none }. The W3C carries exactly this line as an example of the error picture F78, because it turns off the display without setting its own. The developer documentation of Mozilla writes: If you remove the focus indicator, the keyboard operation is inaccessible for sighted users. The visitor then no longer sees which link or button triggers the input button. If the line is in a central file, this applies throughout the website.

Some mouse users benefit from the frame

The W3C points out that mouse users can also need a visible focus, and cites their own style with:focus as a possibility without requiring it. Mozilla describes the case: those who alternate using mouse and keyboard see the frame appear and disappear, and this can confuse people with cognitive limitations. A website that is used much by people with little technical experience can therefore consciously always show the framework.

Examples

Same frame, different rule

Not met
button:focus { outline: 3px solid #1a5fb4; }
/* Rahmen auch nach jedem Mausklick */
Passes
button:focus-visible { outline: 3px solid #1a5fb4; }
/* Rahmen bei Tastatur, nach dem Mausklick in der Regel nicht */

The design remains the same, only the name of the rule changes.

  • Click the mouse on a button: no frame appears.
  • After that, press the Tab key: The frame appears on the next element.
  • Click on an input field: The frame remains visible.
  • Let your agency search for outline: none. If the rule is in the design specifications without a replacement, it should be removed.

More on this topic

Deutsche Fassung dieser Seite

  • Seal Digitale Barrierefreiheit
  • Seal Daten & Recht
  • Seal Technische Qualität
  • Seal Digital Excellence
  • Seal Cyberversicherung

Audited. For a better digital future.euid.com