diff options
| author | Patrick H. Lauke <[email protected]> | 2019-03-12 13:16:18 +0000 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2019-03-12 15:16:49 +0200 |
| commit | 86a97d197e32bcea1804c952025ff8b414a5ef86 (patch) | |
| tree | e6dd48151a448ce8b770c05d76d1731b0d5b8def | |
| parent | 87527d814914d2f7f28009a3309fef49064c78e6 (diff) | |
| download | bootstrap-86a97d197e32bcea1804c952025ff8b414a5ef86.tar.xz bootstrap-86a97d197e32bcea1804c952025ff8b414a5ef86.zip | |
Remove indiscriminate outline suppression for tabindex="-1" elements (#28437)
instead, only apply outline suppression if the browser wouldn't normally apply the focus outline, using the (currently experimental) `:focus-visible` pseudo-class
| -rw-r--r-- | scss/_reboot.scss | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/scss/_reboot.scss b/scss/_reboot.scss index c55d42e44..4955f7fe8 100644 --- a/scss/_reboot.scss +++ b/scss/_reboot.scss @@ -54,12 +54,16 @@ body { background-color: $body-bg; // 2 } -// 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 { +// Future-proof rule: in browsers that support :focus-visible, suppress the focus outline +// on elements that programmatically receive focus but wouldn't normally show a visible +// focus outline. In general, this would mean that the outline is only applied if the +// interaction that led to the element receiving programmatic focus was a keyboard interaction, +// or the browser has somehow determined that the user is primarily a keyboard user and/or +// wants focus outlines to always be presented. +// +// See https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible +// and https://developer.paciellogroup.com/blog/2018/03/focus-visible-and-backwards-compatibility/ +[tabindex="-1"]:focus:not(:focus-visible) { outline: 0 !important; } |
