Skip to content

Commit 6cdc640

Browse files
authored
fix(shortcuts): 🐛 remove special characters on macos (#8719)
1 parent 0e3faf4 commit 6cdc640

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/browser/components/preferences/zen-settings.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,10 +1045,13 @@ var gZenCKSSettings = {
10451045
const modifiersActive = modifiers.areAnyActive();
10461046

10471047
input.classList.remove(`${ZEN_CKS_INPUT_FIELD_CLASS}-not-set`);
1048-
1049-
// This is because on some OSs (windows/macos mostly) the key is not the same as the keycode
1050-
// e.g. CTRL+ALT+3 may be displayed as the euro sign
1051-
let shortcut = event.key;
1048+
1049+
// First, try to read the *physical* key via event.code.
1050+
// If event.code is like "KeyS", "KeyA", ..., strip off "Key" → "S".
1051+
// Otherwise, fall back to event.key (e.g. "F5", "Enter", etc.).
1052+
let shortcut;
1053+
if (event.code && event.code.startsWith("Key")) shortcut = event.code.slice(3);
1054+
else shortcut = event.key;
10521055

10531056
shortcut = shortcut.replace(/Ctrl|Control|Shift|Alt|Option|Cmd|Meta/, ''); // Remove all modifiers
10541057

0 commit comments

Comments
 (0)