Closed Bug 1248093 Opened 4 years ago Closed 4 years ago

tab.move to index zero doesn't work with pinned tabs

Categories

(WebExtensions :: Untriaged, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: andy+bugzilla, Assigned: andy+bugzilla)

Details

(Keywords: dev-doc-complete, Whiteboard: [tabs])

STR:
* create a pinned tab
* call chrome.tabs.move([some_tab.id], {index: 0});

Expected:
* tab moves to the first tab after the pinned tabs

Actual:
* tab does not move
This is actually the expected behavior. Not the documented behavior, granted, but it's what Chrome does.
Status: NEW → RESOLVED
Closed: 4 years ago
Keywords: dev-doc-needed
Resolution: --- → INVALID
It seems like the behavior of move is that pinned and unpinned tabs are treated as distinct groups, and you can't move tabs from one group to another. So you:

* can't move an unpinned tab before any pinned tabs

* can't move a pinned tab after any unpinned tabs

If you try, you get a silent failure (nothing happens). Is that your understanding?

This behavior makes the example add-on tabs-tabs-tabs appear broken when any tabs are pinned, and I think maybe we should fix it. I've made a PR which seems to fix it: if you think it is a good idea to fix this, would you mind taking a look?

https://github.com/mdn/webextensions-examples/pull/49
Flags: needinfo?(kmaglione+bmo)
Commented.
Flags: needinfo?(kmaglione+bmo)
Thanks for reviewing the example update.
I've had a go at the docs: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/move

Weirdest thing I found: it looks like in Chrome, if you try to move a tab and it fails (for example, because you tried to move an unpinned tab to before a pinned tab), then Chrome will still pass the tab into the callback, with the index that it would have been given, if the move had not failed.
Flags: needinfo?(kmaglione+bmo)
That... makes no sense...

The docs look good, though.
Flags: needinfo?(kmaglione+bmo)
(In reply to Kris Maglione [:kmag] from comment #5)
> That... makes no sense...
> 
> The docs look good, though.

Hm, it might make sense if Chrome's implementation had a bug, and the behavior they intended was "first non-pinned-index", as the event handling would suggest.

I've opened bug 1388276 for any "index passed to move() is lower than index of the last pinned tab":
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.