Description
Apologies if this has been answered elsewhere already. I'm struggling to find an agreed-upon answer.
There are some situations where authors decide to send focus to static content via JS (think tabindex="-1"
and .focus()
. By default, browsers render a visual focus outline around these static elements when they receive focus. However, many authors remove this visual focus indicator for static elements and leave them for interactive elements. I find that authors do this because elements with tabindex="-1"
receive focus on click and programmatically.
Some examples include:
- When submitting a form, focus is sent to the container of an error message above the form.
- In a single page application, a routing event automatically focuses the heading at the top of new content. I put together an example of this to illustrate SPA link routing.
The normative text of 2.4.7 states
Any keyboard operable user interface has a mode of operation where the keyboard focus indicator is visible.
The informative text of the understanding document suggests that this is to help "anyone who relies on the keyboard", and users with "attention limitations, short term memory limitations, or limitations in executive processes" 1. understand exactly where focus is on the page at all times, so that, 2. they can predict what will happen when they issue a keyboard command.
Do these situations require a visible focus indicator to meet 2.4.7?
One read is 'yes', since, without it, 1. users may not know exactly where focus is at all times, and 2. users may not be able to predict what will happen when they issue a keyboard command.
Another read is 'no' since the static element itself is not keyboard operable in of itself.