]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: add visible focus outline to rustdoc-toggle
authorMichael Howell <michael@notriddle.com>
Tue, 25 Oct 2022 23:52:50 +0000 (16:52 -0700)
committerMichael Howell <michael@notriddle.com>
Tue, 25 Oct 2022 23:52:50 +0000 (16:52 -0700)
The change in opacity is inconsistent with most of rustdoc, which uses
default browser styles for the focus outline. Unfortunately, just using
the default focus outline here won't work, because it gets applied to
the summary itself instead of the pseudo-element "real button."

src/librustdoc/html/static/css/rustdoc.css

index 173553ed477493b8554427e83f43893f42172ad6..84a1fa2e28ecea1e7c2912c48eea0d0e1bd01926 100644 (file)
@@ -1585,6 +1585,14 @@ details.rustdoc-toggle > summary:hover::before {
        opacity: 1;
 }
 
+details.rustdoc-toggle > summary:focus-visible::before {
+       /* The SVG is black, and gets turned white using a filter.
+          Do the same with the outline.
+       */
+       outline: 1px dotted #000;
+       outline-offset: 1px;
+}
+
 details.rustdoc-toggle.top-doc > summary,
 details.rustdoc-toggle.top-doc > summary::before,
 details.rustdoc-toggle.non-exhaustive > summary,