From f5f42a8cba22fe1616b33cbedf2adc9bf01056b0 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 28 Jun 2022 15:06:48 -0700 Subject: [PATCH] rustdoc: make keyboard commands work when checkboxes are selected --- src/librustdoc/html/static/js/main.js | 3 ++- src/test/rustdoc-gui/settings.goml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 789e7d298fa..c33e2727744 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -419,7 +419,8 @@ function loadCss(cssFileName) { return; } - if (document.activeElement.tagName === "INPUT") { + if (document.activeElement.tagName === "INPUT" && + document.activeElement.type !== "checkbox") { switch (getVirtualKey(ev)) { case "Escape": handleEscape(ev); diff --git a/src/test/rustdoc-gui/settings.goml b/src/test/rustdoc-gui/settings.goml index a43c712ef9a..49478775b05 100644 --- a/src/test/rustdoc-gui/settings.goml +++ b/src/test/rustdoc-gui/settings.goml @@ -122,6 +122,7 @@ click: ".setting-line:last-child .toggle .label" assert-local-storage: {"rustdoc-disable-shortcuts": "true"} // Make sure that "Disable keyboard shortcuts" actually took effect. +// The help popover won't exist yet. press-key: "?" wait-for-css: ("#settings-menu .popover", {"display": "block"})