I used a React library to add the hotkeys, which obviously can't capture keys when the focus is inside the frame (as React doesn't run in there). This focus isn't visualized, so the keys sometimes don't work without being able to see why.
There's a few ways to go about this:
keep focus out of the frame (or kick it out every time)
capture key events and forward them in some way to the hook
use a completely different way to add hotkeys
For now the last option seems best. The library I used doesn't seem to scale very well as many hotkeys get added. It takes much longer than the code to dispatch the action itself, even though that has quite a lot of logic. You can clearly see this on performance recordings where it drowns out other entries at the start of click event handling. It seems to compile new functions every time you use the hotkey. Perhaps this can be fixed with a memo.
I used a React library to add the hotkeys, which obviously can't capture keys when the focus is inside the frame (as React doesn't run in there). This focus isn't visualized, so the keys sometimes don't work without being able to see why.
There's a few ways to go about this:
For now the last option seems best. The library I used doesn't seem to scale very well as many hotkeys get added. It takes much longer than the code to dispatch the action itself, even though that has quite a lot of logic. You can clearly see this on performance recordings where it drowns out other entries at the start of click event handling. It seems to compile new functions every time you use the hotkey. Perhaps this can be fixed with a memo.