jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.37k stars 4.73k forks source link

[7.1.0a0+] Default file browser writes to a custom drive if installed #7210

Open jtpio opened 5 months ago

jtpio commented 5 months ago

Testing with:

The default file browser on the tree page tries to create files and directories in the installed drive, instead of the default file browser:

notebook-drive-issue.webm

Looking more closely, the model seems to be pointing to the custom drive (GitHub:)

image

This is not an issue with 7.0.6, so this is likely related to a change in the JupyterLab 4.1 pre-releases, or in some PRs targeting Notebook 7.1.

Also this does not appear to be an issue in JupyterLab:

jupyterlab-create-new-folder-context-menu.webm

jtpio commented 5 months ago

This could be related to an upstream change w.r.t focus handling, as first clicking on the file browser widget and then creating the new directory seems to be fine:

notebook-custom-drive-focus-issue.webm

jtpio commented 5 months ago

In the related command for creating a new directory, the file browser tracker currentWidget seems to be set to the custom drive (in this case the GitHub: drive):

https://github.com/jupyterlab/jupyterlab/blob/07b93390cf74fbf14d3a1dac3f662fdb4664afed/packages/filebrowser-extension/src/index.ts#L1143-L1147

const widget = tracker.currentWidget;

if (widget) {
   return widget.createNewDirectory();
}
jtpio commented 5 months ago

Looking more into it, and setting a handler for the tracker currentChanged signal:

const { tracker } = factory;
tracker.currentChanged.connect(() => {
  console.log('current changed');
});

The underlying file browser tracker only seems to update its currentWidget when actively clicking on the widget themselves (clicking on the tab is not enough):

notebook-filebrowser-tracker-focus.webm

jtpio commented 5 months ago

This was mitigated in https://github.com/jupyter/notebook/pull/7224.

Moving to 7.1.x, in case this gets fixed upstream in JupyterLab: https://github.com/jupyterlab/jupyterlab/issues/15629