Lesson 12 of 13

Focus Appearance

One vermilion ring shows keyboard focus, stays clear on light and dark surfaces, and is never clipped.

The product has one focus ring. It is a 2px vermilion line, offset from the control so the border does not eat it. It shows for keyboard focus, with :focus-visible, and it does not show for every mouse click. A ring on every click looks like a stuck error. No ring at all hides the path for anyone using a keyboard.

The ring has to clear both a light surface and a dark surface. Vermilion does that on bone and on the dark ground. Do not invent a new ring colour for each button fill. If a parent with overflow, or a sticky bar, cuts the ring, fix the parent. Removing the outline is not a fix.

The left plate cuts the ring on the edge of the card, so the focused control looks broken. The right plate keeps one vermilion ring, offset and whole, on a light surface and on a dark one.

How to check it

  • Tab through the screen. Every control shows the same ring, and a click does not leave one behind.
  • Place the ring on a light surface and on a dark surface. It stays visible on both.
  • Move a focused control to the edge of a card. The ring is complete, not clipped.
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}