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

Focus new tab every time current tab is changed #528

Open
andrii-i opened this issue Jan 26, 2023 · 2 comments
Open

Focus new tab every time current tab is changed #528

andrii-i opened this issue Jan 26, 2023 · 2 comments
Labels
accessibility Addresses accessibility needs enhancement New feature or request

Comments

@andrii-i
Copy link

andrii-i commented Jan 26, 2023

Let multiple tabs exist on a tab bar. If one of them is current and focused and it is closed, focus automatically reverts to the document body (body), not to the new current tab.

Part of the jupyterlab functionality such as hotkeys relies on relevant element being focused. As a result of next tab not getting focus, you can't use "close tab" hotkey (option + W) more than once in a row (please see issue #6648 and discussion in it).

Reverted jupyterlab PR 7349 attempted to fix this by listening to currentChanged messages and activating a "changed to" widget. But Lumino fires multiple currentChanged messages in a quick succession any time tab is closed programmatically so there's a raise condition on jupyterlab side (see discussion in PR 7349 and in PR 7684 that reverts it).

Lumino has access to source of truth, currentIndex parameter in TabBar / correct sequence of calls to set currentIndex(), so focusing a tab every time it becomes current seems like it would solve the problem (for example, inside set currentIndex() call). If you have other thoughts on how to fix this or if I'm missing something in my reasoning, please let me know.

/**
* Set the index of the currently selected tab.
*
* #### Notes
* If the value is out of range, the index will be set to `-1`.
*/
set currentIndex(value: number) {

@welcome
Copy link

welcome bot commented Jan 26, 2023

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@krassowski
Copy link
Member

Side note: the focus change after changing tab was implicated in some performance issues in my profiling. A change to the status quo may help or make things worse, in any case we want to run a manual benchmark so please tag me on a PR if you are planning to work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility Addresses accessibility needs enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants