mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-05 19:08:18 +00:00
fix(shortcuts): 🐛 remove special characters on macos (#8719)
This commit is contained in:
@@ -1045,10 +1045,13 @@ var gZenCKSSettings = {
|
||||
const modifiersActive = modifiers.areAnyActive();
|
||||
|
||||
input.classList.remove(`${ZEN_CKS_INPUT_FIELD_CLASS}-not-set`);
|
||||
|
||||
// This is because on some OSs (windows/macos mostly) the key is not the same as the keycode
|
||||
// e.g. CTRL+ALT+3 may be displayed as the euro sign
|
||||
let shortcut = event.key;
|
||||
|
||||
// First, try to read the *physical* key via event.code.
|
||||
// If event.code is like "KeyS", "KeyA", ..., strip off "Key" → "S".
|
||||
// Otherwise, fall back to event.key (e.g. "F5", "Enter", etc.).
|
||||
let shortcut;
|
||||
if (event.code && event.code.startsWith("Key")) shortcut = event.code.slice(3);
|
||||
else shortcut = event.key;
|
||||
|
||||
shortcut = shortcut.replace(/Ctrl|Control|Shift|Alt|Option|Cmd|Meta/, ''); // Remove all modifiers
|
||||
|
||||
|
Reference in New Issue
Block a user