`activateById` toggle side panel instead of expanding it
Please answer the following questions for yourself before submitting an issue
- [x] I checked the documentation and found no answer
- [x] I checked to make sure that this issue has not already been filed
- [x] I'm reporting the issue to the correct repository
Description
Using the shell function activateById on a side panel widget may result to the opposite behavior, if the widget was already opened.
It may be related to https://github.com/jupyter/notebook/pull/7178.
AFAIU the PR, if the id is provided and the current widget has this ID (it is opened), the expand will collapse the panel.
Reproduce
Hard to reproduce, it needs a extension that provide a sidepanel, and which call the shell.activateById on this sidepanel when it opened.
See context to reproduce it.
Expected behavior
The sidepanel to remain opened.
Context
Found when testing jupyterlab_chat. This line is used to ensure that the sidepanel is open, but the sidepanel is collapsed instead.
cc. @haok1402
https://github.com/jupyter/notebook/pull/7178 has been include to fix https://github.com/jupyter/notebook/issues/7147.
But these changes have led to some unexpected behavior, as the table of contents is not initially intended to be hidden by the menu, in Jupyterlab.
My opinion is that this PR should be reverted, and the menu action changed upstream in Jupyterlab, to toggle the panel instead of only activate it.