Questions/Issues with new tab group saving/pinning functionality

270 views
Skip to first unread message

Tony Confrey

unread,
Oct 16, 2024, 6:59:51 PMOct 16
to Chromium Extensions
I think this is a question for the Chrome team but I'm open to any suggestions.

My extension is a tabs/bookmarks/session manager. It allows tabs and bookmarks to be grouped into named 'topics'. When a bookmarked item is opened in a tab my extension puts that tab into a tab group with the name of the associated topic.

A recent Chrome update allows (and defaults to) displaying and pinning tab groups to the bookmarks bar and saving them so they can be closed and re-opened.

My main problem is as follows. When using my extension if a user opens a saved item, say from the topic 'Project-X', I will open the item in a tab, call tabs.group and name the newly created group 'Project-X'. If the user subsequently closes the group I get a tabs.onRemoved event and mark the item, and group, as closed. But 'Project-X' will still show saved on the bookmark bar. On subsequent re-opening, the same process will be followed and so the user will see two tab groups called 'Project-X' in the bookmark bar.

There is no API access to saved tab groups. I don't see any way my extension can know that a group named 'Project-X' already exists, and a quick experiment shows that the tabgroup ID is not preserved across closing and re-opening.

Showing a persistent representation of tab groups in the browsers UI but not exposing any API access seems like a big gap. (Not to mention a major usability issue for my specific extension.)

Are there any plans to update the API in line with the UI? Any suggestions on how I can work-around in the meantime?

Thanks.
Tony

Patrick Kettner

unread,
Oct 25, 2024, 3:39:48 PMOct 25
to Tony Confrey, Chromium Extensions
Hey Tony!
I am note quite following. When I close the last tab/group chrome asks me if I want to close the tab and delete the group. If I say no, the tab remains, if I say yes, the group is removed from the bookmark bar. I am not sure how you are getting into a state where you have an empty group. But if a group does exist, would `await chrome.tabGroups.query({})` not give you the results you are looking for? That would return all current tab groups.

patrick

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/3c3f9fca-0962-4762-86d4-f2ddfa466456n%40chromium.org.

Tony Confrey

unread,
Oct 28, 2024, 10:16:12 AMOct 28
to Patrick Kettner, Chromium Extensions
Hi Patrick,
Thanks for your response. The situation arises when the user closes a pinned 'tab group', not the individual tabs. You can do this by right clicking the tab group and choosing 'Close Group'. The tab group is subsequently still visible in the bookmarks bar (without an outline) but will not be returned by tabGroups.query. My extension then has no way of knowing that the group is still visible to the user and will create a new group of the same name when grouped tabs are re-opened. The user will then see two identical tab groups in the bookmark bar.

I think a good solution would be for the tabGroups.query call to include pinned groups, whether they are opened or not. I could then tell by querying the tabs if the group contained any open tabs, or alternatively the tabGroup.id could returned as -1 to indicate that it's not currently instantiated.

Note also that the pinned state of a group is not captured as a property in the api, nor is the pin/unpin operation exposed. IMO these gaps in the api should also be closed.

Thanks for your attention to this problem,
Tony

Patrick Kettner

unread,
Oct 28, 2024, 4:33:43 PMOct 28
to Tony Confrey, Chromium Extensions
Ah! Thank you for clarifying and apologies for my misunderstanding. 
It isn’t currently exposed, but I think that sounds like a great addition to the tabGroups API. Would you be open to creating an issue to discuss the idea at the WebExtensions Community Group? 


Tony Confrey

unread,
Oct 29, 2024, 11:09:58 AMOct 29
to Patrick Kettner, Chromium Extensions
Hi Patrick,

On reflection it's more complicated than I had initially thought because pinned tab groups can now 'contain' a set of URLs with no associated browser tabs. I proposed a minimal implementation just providing visibility into the existence of pinned tab groups and a more complete api exposing the full UI capabilities.

Happy to expand on this or discuss further,
Tony

PS FWIW I've been seeing a fair amount of confusion from my users and in Reddit forums related to the new bookmark bar contents and the somewhat scary warning when closing the last tab in a group.
Reply all
Reply to author
Forward
0 new messages