Remove tabindex ruleset
See original GitHub issueThe following isn’t specific to any browser or OS.
Bootstrap contains the following SCSS in _reboot.scss:
// Suppress the focus outline on elements that cannot be accessed via keyboard.
// This prevents an unwanted focus outline from appearing around elements that
// might still respond to pointer events.
//
// Credit: https://github.com/suitcss/base
[tabindex="-1"]:focus {
outline: 0 !important;
}
This was actually removed from suitcss/base five months ago:
tabindex=-1CSS ruleset has been removed in order to support visual feedback on programmatically focused elements.
Please consider also removing it from Bootstrap.
The visual focus indicator is required for accessibility. See e.g.:
- https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-focus-visible.html
- https://www.w3.org/TR/2016/NOTE-WCAG20-TECHS-20161007/F78
- http://www.outlinenone.com/
If an author programmatically sets focus to a div (e.g. when a search form returns results you might move focus to the results) then they will need to undo Bootstrap’s outline: 0.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to remove tabindex on whole div? - jquery - Stack Overflow
What i want is to remove div with glass class from tabing that is cloned, so when i do tab it skip that...
Read more >Elements should not have tabindex greater than zero
Ruleset : axe-core 4.3 ... The first method is to change the tabindex to 0. ... The second method is to remove the...
Read more >Skip to main content link - Functional Accessibility Evaluator
To make any target element focusable, add tabindex="-1" to the element. If the target is an a element, adding tabindex="-1" will remove it...
Read more >Customizing tabIndex and focus of datagrid and multiple ...
You can customize our built-in CSS rules to change the appearance ... set css styling on the entire row and disable css at...
Read more >HTML Roving tabindex Attribute Explained with Examples
You use the HTML tabindex attribute to set an element's tab position, ... tabindex="-1" will remove an element from the natural tab order:....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

looking at our code now, it seems there’s already explicit outline suppression for
.modal… so pushing the above change to reboot would not affect modals. going to investigate if there are other cases where vanilla bootstrap components currently get programmatic focus on elements with negativetabindex…in fact, we can do both: replace the current
[tabindex="-1"]reboot rule with that, and explicitly suppress outline on the modal dialog when it receives programmatic focus. once:focus-visiblehas more support, we can then drop the second part of this (or make it explicitly a positive:focus-visiblestyle for modal dialogs when reached as a result of keyboard interaction)