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

Fix saving shortcut not preventing default #15913

Closed
wants to merge 4 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/application/src/lab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,18 @@ export class JupyterLab extends JupyterFrontEnd<ILabShell> {
*/
protected evtKeydown(event: KeyboardEvent): void {
// Process select keys which may call `preventDefault()` immediately
// TODO: generalise with https://github.com/jupyterlab/lumino/issues/688
if (
// Navigation shortcuts which do not result in user input
// (except for Tab which is handled specially).
['Tab', 'ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'].includes(
event.key
)
) ||
// Saving shortcut which competes with the default browser action
(event.ctrlKey && event.key.toLowerCase() == 's') ||
krassowski marked this conversation as resolved.
Show resolved Hide resolved
// Command + Shift + C on Mac should only open the Command Palette
// (rather than also opening the Dev Tools; metaKey is `Command` on Mac)
(event.metaKey && event.shiftKey && event.key.toLowerCase() == 'c')
Copy link
Member

@jtpio jtpio Mar 7, 2024

Choose a reason for hiding this comment

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

Should this condition also be valid on non-mac devices?

Copy link
Member

@jtpio jtpio Mar 7, 2024

Choose a reason for hiding this comment

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

So this would also fix #15936

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, though honestly I'm also considering just reverting this handler logic altogether until we get the the improved handling in lumino.

Copy link
Member

Choose a reason for hiding this comment

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

Right, but I guess we'll still want this as a hot fix for now?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I mean closing this one and merging revert PR #15938. This is mostly because I think we should not be breaking shortcuts contributed by extensions for which we do not have ability to provide a set of workaround like in this PR.

Copy link
Member

Choose a reason for hiding this comment

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

Ah ok got it 👍

) {
return this.commands.processKeydownEvent(event);
}
Expand Down
Loading