Use focus-visible for focus indicator heuristics #1332
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1321
Uses
:focus:not(:focus-visible)
to surpress keyboard focus indicator according to browser's built in heuristics.Browsers that do not support focus visible will remain unnaffected (i.e. no heauristics should be applied, and no removal of focus indicator should occur).
This PR also contains a change that updates the custom focus indicator for checkbox, radio and switch.
Example 1A: click the menu button with mouse. The menu button will open with no visible focus indicator.
Example 1A: click the menu button with keyboard. The menu button will open with visible focus indicator on first menu item.
Example 2A: click the open lightbox dialog button with mouse. The dialog will open with no visible focus indicator.
Example 2A: click the open lightbox dialog button with keyboard. The dialog will open with visible focus indicator on close button.