File tree 3 files changed +25
-2
lines changed
librustdoc/html/static/js
3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -412,14 +412,15 @@ function loadCss(cssFileName) {
412
412
window . hidePopoverMenus ( ) ;
413
413
}
414
414
415
- const disableShortcuts = getSettingValue ( "disable-shortcuts" ) === "true" ;
416
415
function handleShortcut ( ev ) {
417
416
// Don't interfere with browser shortcuts
417
+ const disableShortcuts = getSettingValue ( "disable-shortcuts" ) === "true" ;
418
418
if ( ev . ctrlKey || ev . altKey || ev . metaKey || disableShortcuts ) {
419
419
return ;
420
420
}
421
421
422
- if ( document . activeElement . tagName === "INPUT" ) {
422
+ if ( document . activeElement . tagName === "INPUT" &&
423
+ document . activeElement . type !== "checkbox" ) {
423
424
switch ( getVirtualKey ( ev ) ) {
424
425
case "Escape" :
425
426
handleEscape ( ev ) ;
@@ -926,6 +927,7 @@ function loadCss(cssFileName) {
926
927
function showHelp ( ) {
927
928
const menu = getHelpMenu ( true ) ;
928
929
if ( menu . style . display === "none" ) {
930
+ window . hidePopoverMenus ( ) ;
929
931
menu . style . display = "" ;
930
932
}
931
933
}
@@ -939,6 +941,8 @@ function loadCss(cssFileName) {
939
941
const shouldShowHelp = menu . style . display === "none" ;
940
942
if ( shouldShowHelp ) {
941
943
showHelp ( ) ;
944
+ } else {
945
+ window . hidePopoverMenus ( ) ;
942
946
}
943
947
} ) ;
944
948
Original file line number Diff line number Diff line change @@ -24,6 +24,11 @@ click: "#help-button"
24
24
assert-css: ("#help-button .popover", {"display": "block"})
25
25
assert-css: ("#settings-menu .popover", {"display": "none"})
26
26
27
+ // Now verify that clicking the help menu again closes it.
28
+ click: "#help-button"
29
+ assert-css: ("#help-button .popover", {"display": "none"})
30
+ assert-css: ("#settings-menu .popover", {"display": "none"})
31
+
27
32
// We check the borders color now:
28
33
29
34
// Ayu theme
Original file line number Diff line number Diff line change @@ -121,6 +121,20 @@ local-storage: {"rustdoc-disable-shortcuts": "false"}
121
121
click: ".setting-line:last-child .toggle .label"
122
122
assert-local-storage: {"rustdoc-disable-shortcuts": "true"}
123
123
124
+ // Make sure that "Disable keyboard shortcuts" actually took effect.
125
+ press-key: "Escape"
126
+ press-key: "?"
127
+ assert-false: "#help-button .popover"
128
+ wait-for-css: ("#settings-menu .popover", {"display": "block"})
129
+
130
+ // Now turn keyboard shortcuts back on, and see if they work.
131
+ click: ".setting-line:last-child .toggle .label"
132
+ assert-local-storage: {"rustdoc-disable-shortcuts": "false"}
133
+ press-key: "Escape"
134
+ press-key: "?"
135
+ wait-for-css: ("#help-button .popover", {"display": "block"})
136
+ assert-css: ("#settings-menu .popover", {"display": "none"})
137
+
124
138
// Now we go to the settings page to check that the CSS is loaded as expected.
125
139
goto: file://|DOC_PATH|/settings.html
126
140
wait-for: "#settings"
You can’t perform that action at this time.
0 commit comments