Skip to content

Commit bb5fb53

Browse files
committed
rustdoc: fix "?" keyboard command when radio button is focused
This extends the special case with checkbox settings to also cover radios.
1 parent deb0575 commit bb5fb53

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/librustdoc/html/static/js/main.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ function loadCss(cssUrl) {
390390
}
391391

392392
if (document.activeElement.tagName === "INPUT" &&
393-
document.activeElement.type !== "checkbox") {
393+
document.activeElement.type !== "checkbox" &&
394+
document.activeElement.type !== "radio") {
394395
switch (getVirtualKey(ev)) {
395396
case "Escape":
396397
handleEscape(ev);

tests/rustdoc-gui/settings.goml

+10
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,16 @@ press-key: "?"
212212
wait-for-css: ("#settings-menu .popover", {"display": "none"})
213213
wait-for-css: ("#help-button .popover", {"display": "block"})
214214

215+
// Now switch back to the settings popover, and make sure the keyboard
216+
// shortcut works when a check box is selected.
217+
click: "#settings-menu > a"
218+
wait-for-css: ("#settings-menu .popover", {"display": "block"})
219+
wait-for-css: ("#help-button .popover", {"display": "none"})
220+
focus: "#theme-system-preference"
221+
press-key: "?"
222+
wait-for-css: ("#settings-menu .popover", {"display": "none"})
223+
wait-for-css: ("#help-button .popover", {"display": "block"})
224+
215225
// Now we go to the settings page to check that the CSS is loaded as expected.
216226
goto: "file://" + |DOC_PATH| + "/settings.html"
217227
wait-for: "#settings"

0 commit comments

Comments
 (0)