-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Disable keyboard shortcut mapping when showing Edit[..]Dialog #3700
Conversation
The downside of this approach is it disables the keyboard shortcuts we define for confirming (or canceling) the edit dialog. I think a slightly different approach is needed - to try to ensure the shortcuts only apply in the right contexts. I have a couple ideas on that and will have a play. |
Fair comment. |
It depends on the proposal 😉 If you have some thoughts, without spending too much time in the code, then please do share so we can see if they are in the right direction. Off the top of my head, we could add some special handling for when the dialogs are open to restrict which key handlers are matched to only those that have their scope set to something particular. |
After some time spent understanding the code structure, I have the impression, that no major change or any special handling of different cases is necessary as there's already a scoping mechanism implemented that references against DOM classes. This mechanism needs just a bit of tweaking
node-red/packages/node_modules/@node-red/editor-client/src/js/ui/keyboard.js Lines 268 to 271 in 1f5588b
} else if (Object.keys(handler).length > 0) {
let depth = -1;
for (h in handler) {
let d = matchHandlerToEvent(evt,handler[h]);
if (d > -1 && d < depth) {
depth = d;
}
}
if (depth > -1) {
partialState = handler;
evt.preventDefault();
}
return null;
} ... The rest of the job means to setup appropriately the shortcut definitions in |
As proposed before:
|
Proposed changes
As explained in this remark: Due to the fact, that the keyboard shortcut mapping was left enabled when showing the various edit dialogs, it was
@
viaoption + l
on Mac.This PR provides a fix for this issue for
Checklist
grunt
to verify the unit tests pass