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

Optional prevent default and asynchronous hold for keybinding execution #689

Merged
merged 7 commits into from
Mar 20, 2024

Conversation

krassowski
Copy link
Member

Closes #688

  • Adds preventDefault option to IKeyBinding and IKeyBindingOptions to enable downstreams to opt out of preventing default on the processed keyboard events
  • Adds CommandRegistry.holdKeyBindingExecution(event: KeyboardEvent, permission: Promise<boolean>): void; method which enables downstream to hold the execution of a keybinding until the permission to execute resolves to true, or to prevent it if it resolves with false

Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @krassowski

This looks great. I'm only a bit confused about the need for the advanced holdKeyBindingExecution.

packages/commands/src/index.ts Show resolved Hide resolved
packages/commands/src/index.ts Outdated Show resolved Hide resolved
@krassowski krassowski marked this pull request as draft March 18, 2024 11:43
@krassowski krassowski marked this pull request as ready for review March 18, 2024 13:22
Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @krassowski

@krassowski krassowski merged commit 066ec93 into jupyterlab:main Mar 20, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New keybinding attribute to indicate shortcuts which prevent default actions
2 participants