[A11y] Keyboard accelerators for toolbar buttons.
This commit is contained in:
parent
162dd17a7a
commit
bbcf630866
|
@ -98,6 +98,20 @@ addEventListener("unload", e => {
|
|||
}
|
||||
}
|
||||
|
||||
let keyHandlers = {
|
||||
"r": "reload",
|
||||
"o": "options",
|
||||
"p": "temp-trust-page",
|
||||
"f": "revoke-temp",
|
||||
"G": "enforce",
|
||||
"T": "enforce-tab",
|
||||
};
|
||||
|
||||
window.addEventListener("keydown", e => {
|
||||
let buttonId = keyHandlers[e.key];
|
||||
if (buttonId) document.getElementById(buttonId).click();
|
||||
}, true);
|
||||
|
||||
let navigate = e => {
|
||||
let sel = e.code === "ArrowUp" ? ":last-child" : "";
|
||||
document.querySelector(`.sites tr.site${sel} input.preset:checked`).focus();
|
||||
|
|
|
@ -497,7 +497,7 @@ var UI = (() => {
|
|||
customizer.classList.toggle("closed", false);
|
||||
let temp = preset.parentNode.querySelector("input.temp");
|
||||
customizer.onkeydown = e => {
|
||||
|
||||
if (e.shiftKey) return true;
|
||||
switch(e.code) {
|
||||
case "Tab":
|
||||
if (document.activeElement === lastInput) {
|
||||
|
|
Loading…
Reference in New Issue