In accessibility-focused CSS, which selector helps reveal focus outlines only for keyboard users and keeps focus indicators clear?

Prepare for the CSS Mastery SAD Maintenance and CSA Stand Ups Test. With flashcards and multiple choice questions, ready yourself for the exam with hints and explanations for every question. Ace your exam today!

Multiple Choice

In accessibility-focused CSS, which selector helps reveal focus outlines only for keyboard users and keeps focus indicators clear?

Explanation:
The selector :focus-visible is designed to reveal focus outlines only when the user is navigating with a keyboard, keeping those indicators clear for keyboard users while avoiding visual clutter for mouse users. When you tab through a page, the browser treats that as keyboard modality and applies the focus style; clicking with a mouse, on the other hand, typically won’t show the focus outline. This balances accessibility with clean visuals. You’d style it like: button:focus-visible { outline: 2px solid #2563eb; } If the browser doesn’t support it, you can still provide a reasonable fallback, but the key idea is to rely on :focus-visible so the focus ring appears for keyboard users and stays hidden during mouse interaction. The other approaches either show outlines all the time, hide them entirely, or use hover—which doesn’t address keyboard accessibility.

The selector :focus-visible is designed to reveal focus outlines only when the user is navigating with a keyboard, keeping those indicators clear for keyboard users while avoiding visual clutter for mouse users. When you tab through a page, the browser treats that as keyboard modality and applies the focus style; clicking with a mouse, on the other hand, typically won’t show the focus outline. This balances accessibility with clean visuals. You’d style it like: button:focus-visible { outline: 2px solid #2563eb; } If the browser doesn’t support it, you can still provide a reasonable fallback, but the key idea is to rely on :focus-visible so the focus ring appears for keyboard users and stays hidden during mouse interaction. The other approaches either show outlines all the time, hide them entirely, or use hover—which doesn’t address keyboard accessibility.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy