Closed Bug 1422509 Opened 7 years ago Closed 6 years ago

Let extensions control which tab is focused when a tab is closed

Categories

(WebExtensions :: Untriaged, enhancement, P5)

57 Branch
enhancement

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1419947

People

(Reporter: yurivkhan, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [design-decision-needed])

Bug 1419649 proposes that closing a tab should focus the tab that was last recently active in the same window.

That behavior is sensible but not the only one that makes sense. Users of Tab Mix Plus are accustomed to being able to choose between focusing:

* Leftmost tab
* The one immediately to the left
* The one immediately to the right
* Rightmost tab
* Last recently active tab
* The one from which this tab was opened
* The tab last recently opened

(Bug 1226546 should depend on this one.)


A few extensions exist that try to do that with existing API, e.g. . However, they do it by listening for tabs.onRemoved, and that event fires *after* the tab has been closed and another tab receives focus, so there is a momentary flash of the unwanted tab, which is distracting.

One possible solution would be to introduce a new event, e.g:

===
browser.tabs.onRemoving.addListener(callback)

callback: Function that will be called before a tab is closed. The function will be passed the following arguments:

* tabId: integer. ID of the tab being closed.
* removeInfo: object. Contains properties of the tab being closed.

The tab is not removed until the callback returns.

As part of its execution, the callback can focus a different tab. If it does, that tab stays focused after the tab is closed.

removeInfo

* windowId: integer. The window whose tab is being closed.
* isWindowClosing: boolean. true if the tab is being closed because the window is being closed.
===
Severity: normal → enhancement
See Also: → 1387372
Priority: -- → P5
Whiteboard: [design-decision-needed]
See Also: → 1419947
Blocks: 1226546
Jayce, this is now the second time I've seen you post an unproductive comment on Bugzilla. This is a professional working environment. Please read the Bugzilla etiquette guide before making another comment. The next time you make a comment like this, your account will be suspended. 

Etiquette guide: https://bugzilla.mozilla.org/page.cgi?id=etiquette.html
:caitmuenster - if the above individual violates bugzilla etiquette again, please open a bug with "MOC: Service Requests" and we can get that taken care of.
Needinfo'ing aswan to investigate whether this should be closed as a dupe of bug 1419947.
Flags: needinfo?(aswan)
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Flags: needinfo?(aswan)
Resolution: --- → DUPLICATE
See Also: 1419947
Blocks: 1459402
No longer blocks: 1226546
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.