diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2020-12-10 21:33:17 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-10 21:33:17 -0800 |
| commit | 3a46a6b9974db88e1690f254cbc2f3a1d6384d28 (patch) | |
| tree | fbc3217d1622be0d670bf8c419b1b78a20f06ede | |
| parent | c94345e3c23cf8e7574165a5cf31650628f51be8 (diff) | |
| parent | 2363a20b9868ae41ac92cac4b06c167c3cb320aa (diff) | |
| download | rust-3a46a6b9974db88e1690f254cbc2f3a1d6384d28.tar.gz rust-3a46a6b9974db88e1690f254cbc2f3a1d6384d28.zip | |
Rollup merge of #79896 - GuillaumeGomez:more-elements-focus, r=Manishearth
Make search results tab and help button focusable with keyboard Fixes https://github.com/rust-lang/rust/issues/79859. I replaced the element with `button` tag, which allows to focus them (and "click" on them using "enter") using only the keyboard. cc ``@sersorrel`` r? ``@Manishearth``
| -rw-r--r-- | src/librustdoc/html/layout.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/static/main.js | 6 | ||||
| -rw-r--r-- | src/librustdoc/html/static/rustdoc.css | 11 | ||||
| -rw-r--r-- | src/librustdoc/html/static/themes/ayu.css | 10 | ||||
| -rw-r--r-- | src/librustdoc/html/static/themes/dark.css | 7 | ||||
| -rw-r--r-- | src/librustdoc/html/static/themes/light.css | 7 |
6 files changed, 23 insertions, 20 deletions
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index e8039942f4f..f2c74c46d7d 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -98,7 +98,7 @@ crate fn render<T: Print, S: Print>( placeholder=\"Click or press ‘S’ to search, ‘?’ for more options…\" \ type=\"search\">\ </div>\ - <span class=\"help-button\">?</span> + <button class=\"help-button\">?</button> <a id=\"settings-menu\" href=\"{root_path}settings.html\">\ <img src=\"{static_root_path}wheel{suffix}.svg\" \ width=\"18\" \ diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index a0ccb078c4a..47847ccb5f6 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -1633,10 +1633,10 @@ function defocusSearchBar() { function makeTabHeader(tabNb, text, nbElems) { if (currentTab === tabNb) { - return "<div class=\"selected\">" + text + - " <div class=\"count\">(" + nbElems + ")</div></div>"; + return "<button class=\"selected\">" + text + + " <div class=\"count\">(" + nbElems + ")</div></button>"; } - return "<div>" + text + " <div class=\"count\">(" + nbElems + ")</div></div>"; + return "<button>" + text + " <div class=\"count\">(" + nbElems + ")</div></button>"; } function showResults(results) { diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 8eef65a231d..61905b8eca8 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -1176,21 +1176,22 @@ pre.rust { height: 35px; } -#titles > div { +#titles > button { float: left; width: 33.3%; text-align: center; font-size: 18px; cursor: pointer; + border: 0; border-top: 2px solid; } -#titles > div:not(:last-child) { +#titles > button:not(:last-child) { margin-right: 1px; width: calc(33.3% - 1px); } -#titles > div > div.count { +#titles > button > div.count { display: inline-block; font-size: 16px; } @@ -1459,7 +1460,7 @@ h4 > .notable-traits { top: 24px; } - #titles > div > div.count { + #titles > button > div.count { float: left; width: 100%; } @@ -1565,7 +1566,7 @@ h4 > .notable-traits { } @media (max-width: 416px) { - #titles, #titles > div { + #titles, #titles > button { height: 73px; } diff --git a/src/librustdoc/html/static/themes/ayu.css b/src/librustdoc/html/static/themes/ayu.css index c1f796f09e8..76bbe4f6201 100644 --- a/src/librustdoc/html/static/themes/ayu.css +++ b/src/librustdoc/html/static/themes/ayu.css @@ -403,22 +403,22 @@ pre.ignore:hover, .information:hover + pre.ignore { border-color: #5c6773; } -#titles > div.selected { +#titles > button.selected { background-color: #141920 !important; border-bottom: 1px solid #ffb44c !important; border-top: none; } -#titles > div:not(.selected) { +#titles > button:not(.selected) { background-color: transparent !important; border: none; } -#titles > div:hover { +#titles > button:hover { border-bottom: 1px solid rgba(242, 151, 24, 0.3); } -#titles > div > div.count { +#titles > button > div.count { color: #888; } @@ -434,7 +434,7 @@ above the `@media (max-width: 700px)` rules due to a bug in the css checker */ .block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro {} .content .highlighted.trait {} .content span.struct,.content a.struct,.block a.current.struct {} -#titles>div:hover,#titles>div.selected {} +#titles>button:hover,#titles>button.selected {} .content .highlighted.traitalias {} .content span.type,.content a.type,.block a.current.type {} .content span.union,.content a.union,.block a.current.union {} diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css index 946ca0a40c9..86ce99284eb 100644 --- a/src/librustdoc/html/static/themes/dark.css +++ b/src/librustdoc/html/static/themes/dark.css @@ -352,16 +352,17 @@ pre.ignore:hover, .information:hover + pre.ignore { border-color: #777; } -#titles > div:not(.selected) { +#titles > button:not(.selected) { background-color: #252525; border-top-color: #252525; } -#titles > div:hover, #titles > div.selected { +#titles > button:hover, #titles > button.selected { border-top-color: #0089ff; + background-color: #353535; } -#titles > div > div.count { +#titles > button > div.count { color: #888; } diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css index e0b9a04921a..52cfdf6f7a3 100644 --- a/src/librustdoc/html/static/themes/light.css +++ b/src/librustdoc/html/static/themes/light.css @@ -343,16 +343,17 @@ pre.ignore:hover, .information:hover + pre.ignore { border-color: #999; } -#titles > div:not(.selected) { +#titles > button:not(.selected) { background-color: #e6e6e6; border-top-color: #e6e6e6; } -#titles > div:hover, #titles > div.selected { +#titles > button:hover, #titles > button.selected { border-top-color: #0089ff; + background-color: #353535; } -#titles > div > div.count { +#titles > button > div.count { color: #888; } |
