Skip to content
Snippets Groups Projects
Verified Commit 1a56a41c authored by Dan Ballard's avatar Dan Ballard Committed by Pier Angelo Vendrame
Browse files

fixup! fixup! Bug 27476: Implement about:torconnect captive portal within Tor Browser

Bug 41526: revert removal of focus to cancle button + add prevention
from keyboard input to trigger multiple buttons as focus switches
parent 8be8c554
1 merge request!608Bug 41688: Rebased stable to 102.10 ESR
......@@ -517,6 +517,9 @@ class AboutTorConnect {
this.hide(this.elements.viewLogButton);
}
this.show(this.elements.cancelButton, true);
if (state.StateChanged) {
this.elements.cancelButton.focus();
}
}
showOffline(error) {
......@@ -772,6 +775,28 @@ class AboutTorConnect {
this.beginAutoBootstrap(value);
}
});
// Delay the "Enter" activation of the given button from "keydown" to
// "keyup".
//
// Without this, holding down Enter will continue to trigger the button
// until the user stops holding. This means that a user can accidentally
// re-trigger a button several times. This is particularly bad when the
// focus gets moved to a new button, and the new button can get triggered
// immediately. E.g. when the "Connect" button is triggered it disappears
// and focus moves to the "Cancel" button.
for (const button of document.body.querySelectorAll("button")) {
button.addEventListener("keydown", event => {
if (event.key === "Enter") {
event.preventDefault();
}
});
button.addEventListener("keyup", event => {
if (event.key === "Enter") {
button.click();
}
});
}
}
initObservers() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment