-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace the KeyboardBinder with hooks #4937
Conversation
7621aac
to
62f1010
Compare
I have just been looking into a bug which occurs when you use a keyboard shortcut while a dropdown is open on the These lines appear to prevent keyboard shortcuts while a dropdown is open, though they are in an event handler that is called after the insomnia/packages/insomnia/src/ui/components/base/dropdown/dropdown.tsx Lines 194 to 195 in 8202b2e
I found this PR and I wanted to mention this behaviour here in case some sort of If this is out of the scope of this PR, I can create an issue and tackle it once this has landed! |
@daniel-stoneuk thanks a lot for mentioning this. It's definitely in the scope and has to do with global shortcuts listening to keyboard events in the body or using the capture phase. The purpose of this PR is to remove the keyboard binder and make it simpler to reason about keyboard events in the app. In order to simplify the changes we decided to move as much of the affected components to function components first (remaining list on the pr comment). Can't promise anything but the plan is to get this merged before the next release 😄 |
62f1010
to
4f11be6
Compare
4f11be6
to
d2ac468
Compare
d2ac468
to
07be90c
Compare
787a4e8
to
03a4cb0
Compare
6d5b6d4
to
d17cd83
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Just went through a code review and tested most of the affected flows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had to break a lot of big rocks in one go in this PR to simplify an approach to keyboard shortcuts that was less indirect. Tested and working fine though.
This aims to fix many issues with the keydown bindings in the app.
Decision: user defined app hotkeys will always override code editor hotkeys, except showAutocomplete, eg. Cmd+d will duplicate request always never delete line
autocomplete is specific to code editor
If someone wants to use a code mirror hotkey they can rebind our default hotkey
There is now a more explicit way to register keyboard shortcuts and define the elements they will be attached to.
Why the createKeyboardHandler method?
keyCode === 'Enter'
but we incorrectly also handle 'Cmd+Enter'/'Ctrl+Enter' etc.Class Components that would make the transition easier if they were Functions instead:
In scope
Out of scope
Also closes
Closes #4766
Closes INS-1573
Closes INS-1187
changelog(Fixes): Fixed a number of issues regarding hotkey shortcuts by replacing the KeydownBinder with hooks