tabs.duplicate does not immediately make the duplicated tab active

UNCONFIRMED
Unassigned

Status

defect
P5
normal
UNCONFIRMED
2 years ago
11 months ago

People

(Reporter: ke5trel, Unassigned)

Tracking

(Blocks 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [tabs])

STR:

1. Install Duplicate Tab Shortcut:
https://addons.mozilla.org/en-US/firefox/addon/duplicate-tab-shortcut
2. Press Alt+Shift+D to duplicate the current tab.

Expected:

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

Actual:

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 https://bugzilla.mozilla.org/show_bug.cgi?id=1483958
Component: Untriaged → General
You need to log in before you can comment on or make changes to this bug.