xP: fix ESC H detection on Macintosh systems

This commit is contained in:
Přemysl Eric Janouch 2022-10-04 20:14:52 +02:00
parent 9dc3dd02f3
commit 4b7258cba0
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 7 additions and 0 deletions

View File

@ -1058,6 +1058,13 @@ let lastWasEscape = false
document.addEventListener('keydown', event => {
event.escapePrefix = lastWasEscape
if (lastWasEscape) {
// https://www.w3.org/TR/uievents-key/#keys-modifier
// https://bugzilla.mozilla.org/show_bug.cgi?id=1232918
if (["Alt", "AltGraph", "CapsLock", "Control", "Fn", "FnLock",
"Meta", "NumLock", "ScrollLock", "Shift", "Symbol", "SymbolLock",
"Hyper", "Super", "OS"].indexOf(event.key) != -1)
return
lastWasEscape = false
} else if (event.code == 'Escape' &&
navigator.userAgentData?.platform === 'macOS') {