From 22bd62836d28492a3beabe7ae9042d15a20ff5d7 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Fri, 11 Feb 2022 16:17:26 +0100 Subject: [PATCH] try key codes for all non-ascii input characters --- CHANGELOG.md | 2 +- modules/util/keybinding.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cd8f2c08..9c9aa80f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,7 +48,7 @@ _Breaking developer changes, which may affect downstream projects or sites that #### :bug: Bugfixes * Fix rendering of KeepRight issues ([#8963]) * Fix KeepRight warnings showing up as "Unknown" issues ([#8925]) -* Fix `⌥` + `W` keyboard shortcut not working on MacOS in certain system languages / keyboard layouts (e.g. Spanish) ([#8905]) +* Fix W keyboard shortcut not working on MacOS in certain system languages / keyboard layouts (e.g. Spanish) ([#8905]) #### :rocket: Presets * Optimize order of values in dropdowns of `access` fields ([#8945]) * Use value of `vehicle` tag as placeholder value of `access` fields for `motor_vehicle` and `bicycle` diff --git a/modules/util/keybinding.js b/modules/util/keybinding.js index 152e979b8..a821801f2 100644 --- a/modules/util/keybinding.js +++ b/modules/util/keybinding.js @@ -54,7 +54,7 @@ export function utilKeybinding(namespace) { // Prefer a match on `KeyboardEvent.key` if (event.key !== undefined) { - tryKeyCode = (event.key.charCodeAt(0) > 255); // outside ISO-Latin-1 + tryKeyCode = (event.key.charCodeAt(0) > 127); // outside ISO-Latin-1 isMatch = true; if (binding.event.key === undefined) { @@ -73,7 +73,7 @@ export function utilKeybinding(namespace) { } // Fallback match on `KeyboardEvent.keyCode`, can happen if: - // - `KeyboardEvent.key` is outside ASCII range (e.g. cyrillic - #4618) + // - `KeyboardEvent.key` is outside ASCII range (e.g. cyrillic - # ) // - alt/option/⌥ key is also requested (e.g. Spanish keyboard on MacOS - #8905) if (!isMatch && (tryKeyCode || binding.event.modifiers.altKey)) { isMatch = (event.keyCode === binding.event.keyCode);