Skip to content
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

The logic for replacing conflicting shortcuts removes all keybindings from the other shortcut #16042

Closed
krassowski opened this issue Mar 22, 2024 · 0 comments · Fixed by #16043
Assignees

Comments

@krassowski
Copy link
Member

Description

If user wants to add a new keybinding for command A, say "Ctrl + J", but command B already uses "Ctrl + J" they will be shown an information about the conflict:

Screenshot from 2024-03-22 09-43-32

There are two problems:

  • if "Ctrl + J" is the default shortcut, it will not be overwritten when clicking "Overwrite"
  • if command B had multiple keybindings assigned, say "Ctrl + J" and "Ctrl +Shift + J" (and both are non-default), both will be removed

This is ok-ish:

handleOverwrite = async () => {
this.props
.deleteShortcut(
this.state.takenByObject.takenBy,
this.state.takenByObject.takenByKey
)
.then(this.handleUpdate());
};

This is bad, see that shortcutId is not being used:

/** Delete shortcut for command, refresh state */
deleteShortcut = async (
shortcutObject: ShortcutObject,
shortcutId: string
): Promise<void> => {
await this.handleUpdate(shortcutObject, ['']);
await this._refreshShortcutList();
};

Related to #15937.

Expected behavior

Only the relevant keybinding is removed, and it is removed reliably regardless if it is default or not

Context

  • JupyterLab version: 4.1.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants