Skip to content

Commit cda901f

Browse files
v5/docs: reintroduce outline for docs code samples, buttons when :not(:focus-visible) (#36507)
* Remove outline suppression for focused `<pre>` Sighted keyboard users rely on knowing where their focus is. If the `<pre>` receives focus (so that it can be scrolled by keyboard users, for instance) then it's essential that they know this is the case * Only suppress outline for buttons when `:not(:focus-visible)` * Add right-hand margin to pre avoids having the focus outline awkwardly clipped by the copy button
1 parent 87aaf94 commit cda901f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

scss/_buttons.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
color: var(--#{$prefix}btn-hover-color);
5353
@include gradient-bg(var(--#{$prefix}btn-hover-bg));
5454
border-color: var(--#{$prefix}btn-hover-border-color);
55-
outline: 0;
5655
// Avoid using mixin so we can pass custom focus shadow properly
5756
@if $enable-shadows {
5857
box-shadow: var(--#{$prefix}btn-box-shadow), var(--#{$prefix}btn-focus-box-shadow);
@@ -61,6 +60,11 @@
6160
}
6261
}
6362

63+
.btn-check:focus:not(:focus-visible) + &,
64+
&:focus:not(:focus-visible) {
65+
outline: 0;
66+
}
67+
6468
.btn-check:checked + &,
6569
.btn-check:active + &,
6670
&:active,

site/assets/scss/_component-examples.scss

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,15 +320,11 @@
320320
pre {
321321
padding: 0;
322322
margin-top: .625rem;
323+
margin-right: 1.875rem;
323324
margin-bottom: .625rem;
324325
white-space: pre;
325326
background-color: transparent;
326327
border: 0;
327-
328-
// Undo tabindex that's automatically added by Hugo
329-
&:focus {
330-
outline: 0;
331-
}
332328
}
333329

334330
pre code {

0 commit comments

Comments
 (0)