about summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2020-10-30 14:27:00 -0700
committerMichael Howell <michael@notriddle.com>2020-10-30 14:31:04 -0700
commit17b8ca952baf5d32ef6e9653b0eda6516386400c (patch)
tree1ff504d03badb0362a39d642531b97fbfb61b9d1 /src/librustdoc/html/render
parent90c7c634e39944873a031624c4fb1dc0aa776e3a (diff)
downloadrust-17b8ca952baf5d32ef6e9653b0eda6516386400c.tar.gz
rust-17b8ca952baf5d32ef6e9653b0eda6516386400c.zip
Pull theme picker keyboard code into main.js
Most of the code in mod.rs should be code that really needs to have
the list of available themes inlined into it.
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/mod.rs50
1 files changed, 0 insertions, 50 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index bbcf3ce97e1..5ac0ffcfbf1 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -807,58 +807,8 @@ function handleThemeButtonsBlur(e) {{
     }}
 }}
 
-function handleThemeKeyDown(e) {{
-    if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {{ return; }}
-    if (!themePicker.parentNode.contains(e.target)) {{ return; }}
-    var active = document.activeElement;
-    switch (e.key) {{
-        case "ArrowUp":
-            e.preventDefault();
-            if (active.previousElementSibling && e.target.id !== "theme-picker") {{
-                active.previousElementSibling.focus();
-            }} else {{
-                showThemeButtonState();
-                themes.lastElementChild.focus();
-            }}
-            break;
-        case "ArrowDown":
-            e.preventDefault();
-            if (active.nextElementSibling && e.target.id !== "theme-picker") {{
-                active.nextElementSibling.focus();
-            }} else {{
-                showThemeButtonState();
-                themes.firstElementChild.focus();
-            }}
-            break;
-        case "Enter":
-        case "Return":
-        case "Space":
-            if (e.target.id === "theme-picker" && themes.style.display === "none") {{
-                e.preventDefault();
-                showThemeButtonState();
-                themes.firstElementChild.focus();
-            }}
-            break;
-        case "Home":
-            e.preventDefault();
-            themes.firstElementChild.focus();
-            break;
-        case "End":
-            e.preventDefault();
-            themes.lastElementChild.focus();
-            break;
-        // The escape key is handled in main.js, instead of here, for two reasons:
-        //
-        // 1 Escape should close the menu, even if it's not focused.
-        // 2 The escape event handler is bound to both keydown and keypress, to work
-        //   around browser inconsistencies. That sort of logic doesn't apply to the
-        //   rest of these keybindings.
-    }}
-}};
-
 themePicker.onclick = switchThemeButtonState;
 themePicker.onblur = handleThemeButtonsBlur;
-document.addEventListener("keydown", handleThemeKeyDown);
 {}.forEach(function(item) {{
     var but = document.createElement("button");
     but.textContent = item;