Rollup merge of #107042 - notriddle:notriddle/rustdoc-js-question, r=GuillaumeGomez

rustdoc: fix corner cases with "?" JS keyboard command
This commit is contained in:
Michael Goulet 2023-01-18 18:00:31 -05:00 committed by GitHub
commit 6595127e66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -390,7 +390,8 @@ function loadCss(cssUrl) {
}
if (document.activeElement.tagName === "INPUT" &&
document.activeElement.type !== "checkbox") {
document.activeElement.type !== "checkbox" &&
document.activeElement.type !== "radio") {
switch (getVirtualKey(ev)) {
case "Escape":
handleEscape(ev);
@ -1082,6 +1083,9 @@ function loadCss(cssUrl) {
* Show the help popup menu.
*/
function showHelp() {
// Prevent `blur` events from being dispatched as a result of closing
// other modals.
getHelpButton().querySelector("a").focus();
const menu = getHelpMenu(true);
if (menu.style.display === "none") {
window.hideAllModals();

View File

@ -203,6 +203,25 @@ press-key: "?"
wait-for-css: ("#help-button .popover", {"display": "block"})
assert-css: ("#settings-menu .popover", {"display": "none"})
// Now switch back to the settings popover, and make sure the keyboard
// shortcut works when a check box is selected.
click: "#settings-menu > a"
wait-for-css: ("#settings-menu .popover", {"display": "block"})
focus: "#auto-hide-large-items"
press-key: "?"
wait-for-css: ("#settings-menu .popover", {"display": "none"})
wait-for-css: ("#help-button .popover", {"display": "block"})
// Now switch back to the settings popover, and make sure the keyboard
// shortcut works when a check box is selected.
click: "#settings-menu > a"
wait-for-css: ("#settings-menu .popover", {"display": "block"})
wait-for-css: ("#help-button .popover", {"display": "none"})
focus: "#theme-system-preference"
press-key: "?"
wait-for-css: ("#settings-menu .popover", {"display": "none"})
wait-for-css: ("#help-button .popover", {"display": "block"})
// Now we go to the settings page to check that the CSS is loaded as expected.
goto: "file://" + |DOC_PATH| + "/settings.html"
wait-for: "#settings"