File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/librustdoc/html/render Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -807,7 +807,7 @@ function handleThemeButtonsBlur(e) {{
807807 }}
808808}}
809809
810- function handleThemeKeyPress (e) {{
810+ function handleThemeKeyDown (e) {{
811811 if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {{ return; }}
812812 if (!themePicker.parentNode.contains(e.target)) {{ return; }}
813813 var active = document.activeElement;
@@ -847,12 +847,18 @@ function handleThemeKeyPress(e) {{
847847 e.preventDefault();
848848 themes.lastElementChild.focus();
849849 break;
850+ // The escape key is handled in main.js, instead of here, for two reasons:
851+ //
852+ // 1 Escape should close the menu, even if it's not focused.
853+ // 2 The escape event handler is bound to both keydown and keypress, to work
854+ // around browser inconsistencies. That sort of logic doesn't apply to the
855+ // rest of these keybindings.
850856 }}
851857}};
852858
853859themePicker.onclick = switchThemeButtonState;
854860themePicker.onblur = handleThemeButtonsBlur;
855- document.addEventListener("keydown", handleThemeKeyPress );
861+ document.addEventListener("keydown", handleThemeKeyDown );
856862{}.forEach(function(item) {{
857863 var but = document.createElement("button");
858864 but.textContent = item;
You can’t perform that action at this time.
0 commit comments