notebook icon indicating copy to clipboard operation
notebook copied to clipboard

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

Open jtpio opened this issue 1 year ago • 4 comments
trafficstars

Testing with:

  • 7.1.0a0, 7.1.0a1 or 7.1.0a2 (or newer)
  • A custom drive, for example https://github.com/jupyterlab/jupyterlab-github/

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 avatar Jan 09 '24 14:01 jtpio

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 avatar Jan 10 '24 08:01 jtpio

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 avatar Jan 11 '24 08:01 jtpio

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 avatar Jan 11 '24 16:01 jtpio

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

jtpio avatar Feb 01 '24 14:02 jtpio