Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

Should current tab change automatically activate? #396

Open
mbektas opened this issue Jun 21, 2019 · 3 comments
Open

Should current tab change automatically activate? #396

mbektas opened this issue Jun 21, 2019 · 3 comments

Comments

@mbektas
Copy link
Contributor

mbektas commented Jun 21, 2019

We are having an issue in JupyterLab (jupyterlab/jupyterlab#6648), when a tab is closed, current tab changes but new current tab doesn't get activated. Keyboard events are not received by the current tab.

In https://github.com/phosphorjs/phosphor/blob/master/packages/widgets/src/tabbar.ts there are a lot of places where currentChange is emitted but activate is only tied to user click. Why an activate is only happening at user click and not on the currentChanged?

@sccolbert
Copy link
Member

The reason for this is because focus might be somewhere else in the application, for example the command palette, when the user closes the current tab. In that case, you wouldn't want the new current tab to steal focus from the command palette.

What we could probably do is check to see if the current tab has focus when the close button is clicked, and if so, activate the new tab when it is made current.

@jasongrout
Copy link
Member

What we could probably do is check to see if the current tab has focus when the close button is clicked, and if so, activate the new tab when it is made current.

That makes sense.

@jasongrout
Copy link
Member

What we could probably do is check to see if the current tab has focus when the close button is clicked, and if so, activate the new tab when it is made current.

This issue came up from closing tabs with a keyboard shortcut, so we probably need to trap this at a deeper level than a mouse click so we cover other ways of closing a tab. Perhaps on the actual child-removed message, since a child may decide to not remove itself on a close request, and we really want this behavior only if the close actually happened and the child is gone.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants