diff options
| author | Michael Howell <michael@notriddle.com> | 2021-07-16 17:24:35 -0700 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2021-08-03 14:35:38 +0200 |
| commit | c58246efe47bea09d4f3e70f536e4c9bb7770749 (patch) | |
| tree | 69e9e3478440668801ea00f7e4f4b267e6b31873 /src/librustdoc/html/static/css/rustdoc.css | |
| parent | 76d247c00a9203c69d6c11a84075392ebb8c3fc5 (diff) | |
| download | rust-c58246efe47bea09d4f3e70f536e4c9bb7770749.tar.gz rust-c58246efe47bea09d4f3e70f536e4c9bb7770749.zip | |
Rustdoc accessibility: use an icon for the [-]/[+] controls
This way, we can show the plus and minus buttons on screens, while voice control will read off actual words "Collapse" and "Expand" instead of reading "open brace minus close brace" and "open brace plus close brace". Part of #87059
Diffstat (limited to 'src/librustdoc/html/static/css/rustdoc.css')
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 91243a4086c..ae321be09e2 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1508,11 +1508,33 @@ details.rustdoc-toggle > summary.hideme > span { } details.rustdoc-toggle > summary::before { - content: "[+]"; + content: "Expand"; font-weight: 300; font-size: 0.8em; letter-spacing: 1px; cursor: pointer; + width: 17px; + height: max(17px, 1.1em); + background: data-url(plus-17x17.png) no-repeat top left; + display: inline-block; + vertical-align: middle; + opacity: .5; + text-indent: 17px; + overflow: hidden; +} + +details.rustdoc-toggle > summary.hideme::before { + /* "hideme" toggles already have a description when they're contracted */ + content: " "; +} + +details.rustdoc-toggle > summary:focus::before { + outline: dotted 1px; +} + +details.rustdoc-toggle > summary:focus::before, +details.rustdoc-toggle > summary:hover::before { + opacity: 1; } details.rustdoc-toggle.top-doc > summary, @@ -1560,20 +1582,40 @@ details.rustdoc-toggle[open] > summary.hideme > span { display: none; } -details.rustdoc-toggle[open] > summary::before { - content: "[−]"; - display: inline; +details.rustdoc-toggle[open] > summary::before, +details.rustdoc-toggle[open] > summary.hideme::before { + width: 17px; + height: max(17px, 1.1em); + background: data-url(minus-17x17.png) no-repeat top left; + display: inline-block; + content: "Collapse"; } details.undocumented > summary::before { - content: "[+] Show hidden undocumented items"; + padding-left: 17px; + height: max(17px, 1.1em); + background: data-url(plus-17x17.png) no-repeat top left; + content: "Show hidden undocumented items"; cursor: pointer; font-size: 16px; font-weight: 300; + opacity: .5; +} + +details.undocumented > summary:focus::before { + outline: dotted 1px; +} + +details.undocumented > summary:focus::before, +details.undocumented > summary:hover::before { + opacity: 1; } details.undocumented[open] > summary::before { - content: "[−] Hide undocumented items"; + padding-left: 17px; + height: max(17px, 1.1em); + background: data-url(minus-17x17.png) no-repeat top left; + content: "Hide undocumented items"; } /* Media Queries */ |
