Pseudo-Corp / SynergismOfficial

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use KeyboardEvent.code instead of key for intl keyboard layouts

nmussy opened this issue · comments

Some keyboard layouts, most notably the French AZERTY, require the use of shift/caps lock to input numbers:
AZERTY

That means that without shifting, the QWERTY layout 1 key is KeyboardEvent.key=1, and on AZERTY is KeyboardEvent.key=&. It's kind of a pain when cycling through challenges, as you need to shift or caps lock to 1E2E etc.

This can be remediated by using KeyboardEvent.code instead, which uses physical key positions on a QWERTY keyboard regardless of the current layout. Thus, key=1 becomes code=Digit1, or code=Numpad1 on the num pad.