Skip to content

Commit 74a4c67

Browse files
authored
Rollup merge of #103554 - notriddle:notriddle/summary-focus-visible, r=jsha
rustdoc: add visible focus outline to rustdoc-toggle 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." Preview: https://notriddle.com/notriddle-rustdoc-demos/focus-outline/test_dingus/fn.test.html ## Screenshots ### light ![image](https://user-images.githubusercontent.com/1593513/197903818-61ce09e2-024e-4ca9-9aba-764039561d0a.png) ### dark ![image](https://user-images.githubusercontent.com/1593513/197903765-76e428ea-71e8-4724-ad21-7a4f9d923ea2.png) ### ayu ![image](https://user-images.githubusercontent.com/1593513/197903790-322e22ae-64b5-4138-b931-9ff3ff54f3b0.png)
2 parents 709462b + b857138 commit 74a4c67

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

+9
Original file line numberDiff line numberDiff line change
@@ -1585,6 +1585,15 @@ details.rustdoc-toggle > summary:hover::before {
15851585
opacity: 1;
15861586
}
15871587

1588+
details.rustdoc-toggle > summary:focus-visible::before {
1589+
/* The SVG is black, and gets turned white using a filter in the dark themes.
1590+
Do the same with the outline.
1591+
The dotted 1px style is copied from Firefox's focus ring style.
1592+
*/
1593+
outline: 1px dotted #000;
1594+
outline-offset: 1px;
1595+
}
1596+
15881597
details.rustdoc-toggle.top-doc > summary,
15891598
details.rustdoc-toggle.top-doc > summary::before,
15901599
details.rustdoc-toggle.non-exhaustive > summary,

0 commit comments

Comments
 (0)