Fix broken ⌥+w keyboard shortcut on MacOS in some keyboard layouts (#8905)

This commit is contained in:
Martin Raifer
2022-02-11 15:59:56 +01:00
parent ad67f81cfd
commit bb3ab9257a
2 changed files with 5 additions and 3 deletions

View File

@@ -48,6 +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])
#### :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`
@@ -57,6 +58,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
[#8774]: https://github.com/openstreetmap/iD/pull/8774
[#8811]: https://github.com/openstreetmap/iD/issues/8811
[#8905]: https://github.com/openstreetmap/iD/issues/8905
[#8925]: https://github.com/openstreetmap/iD/issues/8925
[#8927]: https://github.com/openstreetmap/iD/issues/8927
[#8944]: https://github.com/openstreetmap/iD/issues/8944

View File

@@ -73,9 +73,9 @@ export function utilKeybinding(namespace) {
}
// Fallback match on `KeyboardEvent.keyCode`, can happen if:
// - browser doesn't support `KeyboardEvent.key`
// - `KeyboardEvent.key` is outside ISO-Latin-1 range (cyrillic?)
if (!isMatch && tryKeyCode) {
// - `KeyboardEvent.key` is outside ASCII range (e.g. cyrillic - #4618)
// - 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);
}