From c58246efe47bea09d4f3e70f536e4c9bb7770749 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 16 Jul 2021 17:24:35 -0700 Subject: 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 --- src/librustdoc/html/static/css/rustdoc.css | 54 ++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 6 deletions(-) (limited to 'src/librustdoc/html/static/css/rustdoc.css') 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 */ -- cgit 1.4.1-3-g733a5