jupyterlab / jupyterlab-shortcutui

A JupyterLab extension for managing keyboard shortcuts
BSD 3-Clause "New" or "Revised" License
54 stars 15 forks source link

UI stops working if user shortcuts are present #59

Closed stefansimik closed 1 year ago

stefansimik commented 4 years ago

UI works correctly with default shortcut settings in Jupyterlab.

If one edits keybord shortcuts via: Settings menu -> Advanced Settings Editor -> Keyboard shortcuts and adds some user settings like:

{
    "shortcuts": [
        {
            "command": "runmenu:run",
            "keys": [
                ""
            ],
            "selector": "[data-jp-code-runner]"
        },    
        {
            "command": "runmenu:restart-and-run-all",
            "keys": [
                "Shift Enter"
            ],
            "selector": "[data-jp-code-runner]"
        }
    ]
}

then this UI stops working completely - i.e. nothing opens after this UI is invoked. When I rollback user preferences back to defaults, then UI starts working and opens again.

Expected behavior: UI should work also with custom user-shortcuts and display them correctly.

My configuration:

yongrenjie commented 4 years ago

I think this has to do only with certain user-settings. I have not tried your example but you may want to figure out if it's just one of them.

Personally, I have noticed this bug when I disable all shortcuts for a particular item. To get round that I simply defined a different shortcut (which I won't use).

TejasAvinashShetty commented 3 years ago

Maybe the shift +enter shortcut is also used by some another item?

TejasAvinashShetty commented 3 years ago

Maybe the selector has to be a body. I tried this and it ran beautifully.

{
    "shortcuts": [
        {
            "command": "notebook:run-all-cells",
            "keys": [
                "Ctrl Shift M"
            ],
            "selector": "body"
        },
        {
            "command": "notebook:run-all-above",
            "keys": [
                "Ctrl Shift A"
            ],
            "selector": "body"
        },
        {
            "command": "notebook:run-all-below",
            "keys": [
                "Ctrl Shift B"
            ],
            "selector": "body"
        }
    ]
}