question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove tabindex ruleset

See original GitHub issue

The 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=-1 CSS 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.:

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:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
patrickhlaukecommented, Mar 9, 2019

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 negative tabindex

0reactions
patrickhlaukecommented, Mar 9, 2019

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-visible has more support, we can then drop the second part of this (or make it explicitly a positive :focus-visible style for modal dialogs when reached as a result of keyboard interaction)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found