Skip to content

Commit

Permalink
Workaround for the file browser tracker focus issue (#7224)
Browse files Browse the repository at this point in the history
* Workaround for the file browser tracker focus issue

* fix missing default
  • Loading branch information
jtpio authored Jan 26, 2024
1 parent 1145745 commit 5d265b9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/tree-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
FileBrowser,
Uploader,
IDefaultFileBrowser,
IFileBrowserFactory,
} from '@jupyterlab/filebrowser';

import { ISettingRegistry } from '@jupyterlab/settingregistry';
Expand Down Expand Up @@ -263,6 +264,7 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
ITranslator,
ISettingRegistry,
IToolbarWidgetRegistry,
IFileBrowserFactory,
],
optional: [
IRunningSessionManagers,
Expand All @@ -277,6 +279,7 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
translator: ITranslator,
settingRegistry: ISettingRegistry,
toolbarRegistry: IToolbarWidgetRegistry,
factory: IFileBrowserFactory,
manager: IRunningSessionManagers | null,
settingEditorTracker: ISettingEditorTracker | null,
jsonSettingEditorTracker: IJSONSettingEditorTracker | null
Expand Down Expand Up @@ -381,6 +384,21 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
}
);

const { tracker } = factory;

// TODO: remove
// Workaround to force the focus on the default file browser
// See https://github.com/jupyterlab/jupyterlab/issues/15629 for more info
const setCurrentToDefaultBrower = () => {
tracker['_pool'].current = browser;
};

tracker.widgetAdded.connect((sender, widget) =>
setCurrentToDefaultBrower()
);

setCurrentToDefaultBrower();

return nbTreeWidget;
},
};
Expand Down

0 comments on commit 5d265b9

Please sign in to comment.