]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
v5/docs: reintroduce `outline` for docs code samples, buttons when `:not(:focus-visib...
authorPatrick H. Lauke <redux@splintered.co.uk>
Thu, 1 Sep 2022 01:30:23 +0000 (02:30 +0100)
committerGitHub <noreply@github.com>
Thu, 1 Sep 2022 01:30:23 +0000 (18:30 -0700)
* 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

scss/_buttons.scss
site/assets/scss/_component-examples.scss

index 30f435c0190a56f674979690d24d09c58b942c43..09bdf032b8159937bf989f37173f9477cd1522b0 100644 (file)
@@ -52,7 +52,6 @@
     color: var(--#{$prefix}btn-hover-color);
     @include gradient-bg(var(--#{$prefix}btn-hover-bg));
     border-color: var(--#{$prefix}btn-hover-border-color);
-    outline: 0;
     // Avoid using mixin so we can pass custom focus shadow properly
     @if $enable-shadows {
       box-shadow: var(--#{$prefix}btn-box-shadow), var(--#{$prefix}btn-focus-box-shadow);
     }
   }
 
+  .btn-check:focus:not(:focus-visible) + &,
+  &:focus:not(:focus-visible) {
+    outline: 0;
+  }
+
   .btn-check:checked + &,
   .btn-check:active + &,
   &:active,
index 6f325689462ee132681edeb353c658e36535a85e..f4865daf8a42b9878363a61f5bc66a2c21bb0428 100644 (file)
   pre {
     padding: 0;
     margin-top: .625rem;
+    margin-right: 1.875rem;
     margin-bottom: .625rem;
     white-space: pre;
     background-color: transparent;
     border: 0;
-
-    // Undo tabindex that's automatically added by Hugo
-    &:focus {
-      outline: 0;
-    }
   }
 
   pre code {