0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-21 23:03:11 -05:00

Fix Shift-number shortcuts don't work on windows

The perennial issue of should keyboard shortcuts be about the character
or the key!
This commit is contained in:
Neil Jenkins 2024-03-04 10:52:07 +11:00
parent 43799dc57d
commit 46bc36861e

View file

@ -28,6 +28,12 @@ const _onKey = function (this: Squire, event: KeyboardEvent): void {
// control key modifiers.
let key = event.key;
let modifiers = '';
const code = event.code;
// If pressing a number key + Shift, make sure we handle it as the number
// key and not whatever different character the shift might turn it into.
if (/^Digit\d$/.test(code)) {
key = code.slice(-1);
}
if (key !== 'Backspace' && key !== 'Delete') {
if (event.altKey) {
modifiers += 'Alt-';