Skip to content

Hotkeys don't work on Windows with non en-us keyboard layout #15

Description

@reeywhaar

Current way of matching hotkey with event.key property leads to broken hotkeys on Windows (Chrome, Vivaldi at least) as, for example with ru-RU locale on keybord hitting cmd+b will send event with key property set to cyrillic "и" and not "b".

First it was found in umputun/remark42#404

Images provided by @Andrew-Shtein prove difference in key prop

Issue located here:

function shortcut(toolbar: Element, event: KeyboardEvent) {
if ((event.metaKey && modifierKey === 'Meta') || (event.ctrlKey && modifierKey === 'Control')) {
const button = toolbar.querySelector(`[hotkey="${event.key}"]`)
if (button) {
button.click()
event.preventDefault()
}
}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions