plate
plate copied to clipboard
Can't use accent non ascii hotkey
Description
Can't use any non ascii hotkey
Sandbox Example sandbox
I added many hotkeys to MARK_BOLD
mod+e and mod+b works.
mod+é and mod+! doesn't work
I tried "mod+2", it works. on french keyboard é
is the default key for 2
in qwerty(numbers need shift)
It seems to work on slate.
Environment "dependencies": { "@udecode/slate-plugins": "^1.0.0-alpha.25", "react": "^17.0.2", "react-dom": "^17.0.2", "slate": "^0.62.0", "slate-history": "^0.62.0", "slate-hyperscript": "^0.62.0", "slate-react": "^0.62.0" }, ubuntu 20.04 Firefox 88
We're currently using is-hotkey. I plan to move to https://github.com/jaywcjlove/hotkeys
slate also use https://github.com/ianstormtaylor/is-hotkey/blob/master/src/index.js and it's ok some I'm not sure it's related to that. I try to investigate the code base but I'm lost, could you tell me where I could search for further experiment ?
This is where it's used https://github.com/udecode/slate-plugins/blob/8c94295c0a0871d7934be692286b1a66db6ef372/packages/common/src/utils/getToggleMarkOnKeyDown.ts#L16
Maybe try is-hotkey on a sandbox?
Ok it's not a bug it's a feature :()
isHotkey works like that.
By default the hotkey string is checked using event.which. But you can also pass in byKey: true to compare using the KeyboardEvent.key API, which stays the same regardless of keyboard layout.
So do we want to support to support event.key ? I think we should and it should be default since which
is deprecated : https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/which
When ? : maybe after moving to hotkeys
lib.
But since which
is deprecated, key
should become the default in slate-plugins. That's a hug break to the API that should be done before 1.0
OK for the new default. Added to #672