Inwerpsel / use-theme-editor

A React theme editor
GNU General Public License v3.0
4 stars 0 forks source link

Hotkeys not captured when focus is inside frame #14

Open Inwerpsel opened 1 year ago

Inwerpsel commented 1 year ago

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.