Skip to content

Commit cec6988

Browse files
committed
rustdoc: fix help menu popover toggling
1 parent 94e9374 commit cec6988

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,7 @@ function loadCss(cssFileName) {
926926
function showHelp() {
927927
const menu = getHelpMenu(true);
928928
if (menu.style.display === "none") {
929+
window.hidePopoverMenus();
929930
menu.style.display = "";
930931
}
931932
}
@@ -939,6 +940,8 @@ function loadCss(cssFileName) {
939940
const shouldShowHelp = menu.style.display === "none";
940941
if (shouldShowHelp) {
941942
showHelp();
943+
} else {
944+
window.hidePopoverMenus();
942945
}
943946
});
944947

src/test/rustdoc-gui/pocket-menu.goml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ click: "#help-button"
2424
assert-css: ("#help-button .popover", {"display": "block"})
2525
assert-css: ("#settings-menu .popover", {"display": "none"})
2626

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+
2732
// We check the borders color now:
2833

2934
// Ayu theme

0 commit comments

Comments
 (0)