Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create a replacement default file browser with different aria label, icon, etc. #15689

Closed
afshin opened this issue Jan 24, 2024 · 0 comments · Fixed by #15697
Closed

Comments

@afshin
Copy link
Member

afshin commented Jan 24, 2024

The default file browser's title, aria label, and role are set outside of the plugin that provides the default file browser (@jupyterlab/filebrowser-extension:default-file-browser), and are instead defined in the extension that adds the default file browser to the lab shell, here:

// Set attributes when adding the browser to the UI
browser.node.setAttribute('role', 'region');
browser.node.setAttribute('aria-label', trans.__('File Browser Section'));
browser.title.icon = folderIcon;
// Show the current file browser shortcut in its title.
const updateBrowserTitle = () => {
const binding = find(
app.commands.keyBindings,
b => b.command === CommandIDs.toggleBrowser
);
if (binding) {
const ks = binding.keys.map(CommandRegistry.formatKeystroke).join(', ');
browser.title.caption = trans.__('File Browser (%1)', ks);
} else {
browser.title.caption = trans.__('File Browser');
}
};
updateBrowserTitle();
app.commands.keyBindingChanged.connect(() => {
updateBrowserTitle();
});

Arguably, these attributes are inherently part of the "content" of the file browser and the responsibility for setting them and keeping them updated should be with the @jupyterlab/filebrowser-extension:default-file-browser plugin instead so that an alternative file browser (e.g., suppose it is called "Git Browser" or "Cloud Browser", has a different icon, etc.) can correctly display its icon, caption, aria label, etc. without it being clobbered when it is added to JupyterLab.

** Proposal **
Move this functionality from @jupyterlab/filebrowser-extension:widget to @jupyterlab/filebrowser-extension:default-file-browser.

cc: @DenisaCG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants