-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing focus outline for tabindex="-1" has undesired side effects #29875
Comments
Yep exactly. And focus must be visible:
If you absolutely must remove focus outlines (but why?), consider using the :focus-visible polyfill so focus outlines are only hidden from mouse users, not keyboard users. |
You are right, It's clear that focus must be visible for keyboard actionable elements, but I disagree that the focus outline must be visible in my example on the heading where the focus is set programmatically. Are you sure, that WCAG means that focus styles must also be visible on non-keyboard actionable elements? I haven't found anything on that in WCAG. For example, the links to WCAG specs that you provided are only talking about focus styles on keyboard actionable elements. |
Even if clicking your focused heading has no effect, there must be some reason you're moving the focus to heading (so that focus is moved to the heading at the start of a new dynamically rendered section/page, I assume). In that case, there's value in having the visual indication of where focus currently is because it makes clear what will happen when the user presses tab or shift+tab to move the focus forward or backward. Removing the focus indicator is needlessly disorienting. Why remove it? |
Because arguably focus indication denotes something that interactive and actionable to some users, who may then be disoriented when they try to activate/trigger something they think it's interactive when it's not. FWIW there's disagreement on this point even in AGWG w3c/wcag#1001 |
My original case is almost exactly like one of the examples in Patrick's link.
The container has |
@patrickhlauke Is this something we should leave open and act on? |
personally, i'd say our current approach of suppression is fine (since the topic itself is open to discussion even in AGWG, see #29875 (comment)). we could consider adding a future-proofed |
Revisiting this, essentially what the change in #28437 did was to essentially not forcibly reset/normalise browser behavior for whether or not they add an outline to vanilla elements with Noting this is not necessarily a bootstrap problem, as Safari does this for completely vanilla HTML. what bootstrap used to do before #28437 was to explicitly suppress this default behavior, but it did cause issues at the time where some of our components then ended up having their default outline suppressed. I think the positives of the change outweigh the inconvenience of the reboot now not explicitly suppressing Safari's default behavior. Noting that when/if Safari also supports If authors want to suppress this behavior specifically for their vanilla elements/interactions, they will have to add the explicit suppression in themselves, I'd say. Closing for this reason. |
adding that Firefox on macOS, but not on Windows, seems to have taken a weird halfway-house approach of showing the focus outline on Long story short, the issue at its core now becomes: do we want reboot.css to forcibly suppress this particular quirk between Windows browsers (where the outline doesn't show at all), and macOS (where Safari and Firefox do show an outline)? (i.e. The issue should be "Make reboot explicitly suppress |
Removing indiscriminate outline suppression for tabindex="-1" elements in version 4.4.0 causes undesired side effects in vanilla js behaviour.
An example: When element.scrollIntoView() is used with focus() there will now be an outline around the element which has been scrolled into view. In case you are wondering, the focus must be programmatically moved to the element so that keyboard focus will also follow the scrollIntoView.
Tested on macOS with Chrome 79, Safari 13.04 and Firefox 71.0
The text was updated successfully, but these errors were encountered: