adopted-ember-addons / adopted-ember-addons/ember-keyboard

Windows `keydown` with `shift` triggers with the uppercase key

Aperta
#621 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
177
Fork
59
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hey there! Thanks for this great addon! 😄

I'm trying to add a keyboard shortcut in my app, something like `cmd+shift+g`. I'm registering it like `{{on-key "cmd+shift+g" this.doSomething}}`. It seems to work on Mac, however on Windows the shortcut is never triggered.

Looking at [javascript.info](https://javascript.info/keyboard-events) on Mac, the keydown event is triggered with lowercase `g`:

![ic 2022-04-12 at 21 18 57@2x](https://user-images.githubusercontent.com/1569205/163046696-0edbf02c-076b-4b94-9bed-0aa6b81f1d3f.png)

On Windows, `keydown` is triggered with uppercase `G`:

![ic 2022-04-12 at 21 20 00@2x](https://user-images.githubusercontent.com/1569205/163046842-341d89e7-f762-469f-b03d-862b8143cb1c.png)

Anything with `shift` seems to trigger with its uppercase variation. I'm assuming the shortcut isn't triggered because of that. I cannot use `code` because that doesn't seem to work with different keyboard layouts.

----

Questions:

1. Is this known? Are there any known workarounds for this?
2. Is this something that should be handled within the library? For now, registering all variations of the shortcut (i.e. both `cmd+shift+g` and `cmd+shift+G`) seems to work, but it also feels like I'm doing the wrong thing!

I'd appreciate any thoughts—thank you!

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.