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

Disable keyboard shortcuts when entring text in create shortcut menu #2904

Closed
matsievskiysv opened this issue Oct 5, 2017 · 7 comments · Fixed by #2912
Closed

Disable keyboard shortcuts when entring text in create shortcut menu #2904

matsievskiysv opened this issue Oct 5, 2017 · 7 comments · Fixed by #2912

Comments

@matsievskiysv
Copy link

In version 5.1.0 of notebook when entering keyboard shortcut menu from Help->Keyboard shortcuts->Edit shortcuts global shortcuts are not disabled.
For example, if I want to type Ctrl-Enter I would get only Ct-Ente because r and l are binded to the jupyter commands.

@takluyver
Copy link
Member

It appears to be working correctly for me. What browser are you using? Can you describe exactly what sequence of clicks does this?

@matsievskiysv
Copy link
Author

I experience the same behavior on firefox nightly 58.0a1, surf 2.0 and ungoogled-chromium 58.
Exact key sequence is described in my previous message.
Note, that the same menu, accessed through Help->Edit Keyboard Shortcuts works fine.

@takluyver
Copy link
Member

Ah, now I see it. Sorry, I skim read and was going to it directly from the help menu.

@takluyver
Copy link
Member

Here's the relevant code:

.click(function () {
// close this dialog
$(that.shortcut_dialog).modal("toggle");
// and open the next one
that.keyboard_manager.actions.call(
'jupyter-notebook:edit-command-mode-keyboard-shortcuts');
});

When a dialog opens, it disables our shortcuts, and when it closes, it re-enables them. But for some reason, the event from closing the first dialog fires after the event from opening the second one. So the shortcuts get re-enabled by the first dialog closing, even though another one is still open.

@Carreau @gnestor any ideas how to avoid that?

@Carreau
Copy link
Member

Carreau commented Oct 9, 2017

@Carreau @gnestor any ideas how to avoid that?

Not exactly sure; we should try to have a stack-based disablig / refcounting, but that might lead to other bugs.

@gnestor
Copy link
Contributor

gnestor commented Oct 9, 2017

This seems to work for me:

$(that.shortcut_dialog).on('hidden.bs.modal', function (e) {
    that.keyboard_manager.actions.call(
        'jupyter-notebook:edit-command-mode-keyboard-shortcuts'
    );
});

@takluyver
Copy link
Member

Thanks @gnestor

@minrk minrk added this to the Reference milestone Sep 13, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants