Skip to content

Commit

Permalink
Bug fix: Keyboard shortcut set from Manage Extension Shortcuts not re…
Browse files Browse the repository at this point in the history
…freshed in extension prefs page when it is reset

(issue #88)
- Also: minor code cleanup
  • Loading branch information
aecreations committed Sep 25, 2023
1 parent c38e396 commit 8cb7643
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions wx-src/pages/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,21 @@ async function init(aEvent)
$("reset-shortcut").addEventListener("click", aEvent => {
browser.commands.reset(aeConst.CMD_PANIC_BUTTON_ACTION);

$("panicbutton-key").selectedIndex = 7;
$("panicbutton-key-modifiers").selectedIndex = 0;
// Unhide the two drop-down menus for the keyboard shortcut if they
// were hidden because the older shortcut was set from Add-ons Manager.
let keySelectElt = $("panicbutton-key");
let keyModSelectElt = $("panicbutton-key-modifiers");

keySelectElt.style.display = "inline-block";
keySelectElt.selectedIndex = 7;
keyModSelectElt.style.display = "inline-block";
keyModSelectElt.selectedIndex = 0;

let externKeybShct = $("extern-keyb-shct");
externKeybShct.style.display = "none";
externKeybShct.innerText = "";

$("shct-note").innerText = browser.i18n.getMessage("prefsShortcutKeyNote");
});

$("toolbar-button-caption").addEventListener("blur", aEvent => {
Expand Down Expand Up @@ -429,8 +442,8 @@ async function init(aEvent)
$("shct-note").innerText = browser.i18n.getMessage("prefsOutsideShct");
}
else {
$("panicbutton-key").style.display = "inline-block";
$("panicbutton-key-modifiers").style.display = "inline-block";
keySelectElt.style.display = "inline-block";
keyModSelectElt.style.display = "inline-block";
$("shct-note").innerText = browser.i18n.getMessage("prefsShortcutKeyNote");
}

Expand Down

0 comments on commit 8cb7643

Please sign in to comment.