tabs.duplicate does not immediately make the duplicated tab active



2 years ago
11 months ago


(Reporter: ke5trel, Unassigned)


(Blocks 1 bug)

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [tabs])


1. Install Duplicate Tab Shortcut:
2. Press Alt+Shift+D to duplicate the current tab.


tabs.duplicate should create a new tab and immediately make it active like Chrome.


New tab is created in background and only after it finishes loading does it become active. This delayed tab switching is not good UX.
Summary: tabs.duplicate makes new tab active only after it finishes loading → tabs.duplicate does not immediately make the duplicated tab active
Whiteboard: [tabs]
If the default behavior will be to activate the tab, then how would it be possible to duplicate without activating?

It seems like `tabs.duplicate(id, {active: false})` should be the way if we need chrome parity, or keep the default as non-active and either add `{active: true}` or keep it as two operations (duplicate and `update(id, {active: true})`).
(In reply to Zibi Braniecki [:gandalf][:zibi] from comment #1)
> or keep it as two operations (duplicate and `update(id, {active: true})`).

The tabs.duplicate() promise is not fulfilled until after the duplicated tab has been fully loaded which is too late for updating the tab's active state. It is possible to add a listener to tabs.onCreated to get the next new tab and immediately update its active state but this is quite hacky. There are currently at least five extensions that do tab duplication (Duplicate Tab Shortcut, Duplicate tab, Undo|Duplicate Tab, Keyboard Shortcut for Tab Duplication and FoxyTab) and none of them do this, suffering from a delay before the duplicated tab is made active.

Chrome is default active and so is Firefox when using middle/ctrl-click on the refresh button (regardless of browser.tabs.loadInBackground) so tabs.duplicate() should also be default active. I can't think of a use case for duplicating tabs in the background myself but it sounds like something that would be nice to have as an option.
Priority: -- → P5
Product: Toolkit → WebExtensions
Bulk move of bugs per
Component: Untriaged → General
You need to log in before you can comment on or make changes to this bug.