Skip to content

Conversation

@brichet
Copy link
Collaborator

@brichet brichet commented Jan 8, 2026

This PR reverts #7178.

#7178 changes the behavior of panel.expand(), and toggle the panel instead of expanding it. Therefore, the command shell.activateById can collapse the side panel, which is not the expected behavior most of the time.

References

Fixes (again) #7147
Fixes #7534
Fixes #7790 (comment)
Related to jupyterlab/jupyter-chat#105 (comment) (workaround at https://github.com/jupyterlab/jupyter-chat/blob/5b4040e83374470375eb090683f4850f9df7dd2d/packages/jupyterlab-chat-extension/src/index.ts#L697-L699)

Code changes

  • Revert Fix toggle functionality for widgets. #7178
  • Add some method in shell to:
    • get the area of a widget
    • check if a side panel is visible from area
    • expand a panel from area
    • collapse a panel from area
  • Add a plugin to override the upstream menu items "Table of Contents" and "Debugger Panel" to toggle the panels instead of activating them.

User-facing changes

Do not hide a side panel when using shell.activateById() anymore.

Backwards-incompatible changes

None

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

Binder 👈 Launch a Binder on branch brichet/notebook/fix_sidepanel_activate

@brichet
Copy link
Collaborator Author

brichet commented Jan 8, 2026

I wanted to replace the menu item or the command relative to the TOC and the debugger, with a commands toggling the side panel.
But I couldn't find a way to disable (using public API) a core command from an extension, or to remove an item.

Perhaps fixing #7147 should be done upstream in Jupyterlab, by changing the commands to toggle instead of activate ?

@brichet brichet changed the title Revert "Fix toggle functionality for widgets. (#7178)" Fix toggling the side panels from menu Jan 8, 2026
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried unsuccessfully to replace the upstream shortcuts, but it seems to also disable the new shortcuts

"jupyter.lab.shortcuts": [
    {
      "command": "toc:show-panel",
      "disabled": true,
      "keys": ["Accel Shift K"],
      "selector": "body"
    },
    {
      "command": "toc:toggle-panel",
      "keys": ["Accel Shift K"],
      "selector": "body"
    },
    {
      "command": "debugger:show-panel",
      "disabled": true,
      "keys": ["Accel Shift E"],
      "selector": "body"
    },
    {
      "command": "debugger:toggle-panel",
      "keys": ["Accel Shift E"],
      "selector": "body"
    }
  ]

@brichet brichet marked this pull request as ready for review January 8, 2026 16:30
@brichet
Copy link
Collaborator Author

brichet commented Jan 8, 2026

I wanted to replace the menu item or the command relative to the TOC and the debugger, with a commands toggling the side panel. But I couldn't find a way to disable (using public API) a core command from an extension, or to remove an item.

Perhaps fixing #7147 should be done upstream in Jupyterlab, by changing the commands to toggle instead of activate ?

Finally the menu item can be disabled from the settings.
Thanks @jtpio for the tip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

activateById toggle side panel instead of expanding it

1 participant