File tree 1 file changed +8
-2
lines changed
src/librustdoc/html/render
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -807,7 +807,7 @@ function handleThemeButtonsBlur(e) {{
807
807
}}
808
808
}}
809
809
810
- function handleThemeKeyPress (e) {{
810
+ function handleThemeKeyDown (e) {{
811
811
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {{ return; }}
812
812
if (!themePicker.parentNode.contains(e.target)) {{ return; }}
813
813
var active = document.activeElement;
@@ -847,12 +847,18 @@ function handleThemeKeyPress(e) {{
847
847
e.preventDefault();
848
848
themes.lastElementChild.focus();
849
849
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.
850
856
}}
851
857
}};
852
858
853
859
themePicker.onclick = switchThemeButtonState;
854
860
themePicker.onblur = handleThemeButtonsBlur;
855
- document.addEventListener("keydown", handleThemeKeyPress );
861
+ document.addEventListener("keydown", handleThemeKeyDown );
856
862
{}.forEach(function(item) {{
857
863
var but = document.createElement("button");
858
864
but.textContent = item;
You can’t perform that action at this time.
0 commit comments