Skip to content

Addition of the webextensions.api.tabGroups documentation #39370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from review
Co-authored-by: Simeon Vincent <svincent@gmail.com>
Co-authored-by: Rob Wu <rob@robwu.nl>
  • Loading branch information
3 people authored May 12, 2025
commit c581e686f6c4b1fd40c7eb4708fc308103eac999
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Values of this type are a string and can take these values:
- pink
- purple
- red
- yello
- yellow

{{WebExtExamples("h2")}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ browser-compat: webextensions.api.tabGroups

This API enables extensions to modify and rearrange [tab groups](https://support.mozilla.org/en-US/kb/tab-groups).

Tab groups persist across browser restarts, except for tab groups in private browsing windows. When a tab group is restored, its tab group ID may differ from its original value.
Tab groups may persist across browser restarts as part of session restore. Tab groups in private browsing windows do not persist across restarts. When a tab group is restored, its `groupId` may differ from its original value.

The `tabGroups` API doesn't offer the ability to create or remove tab groups. Use the {{WebExtAPIRef("tabs.group()")}} and {{WebExtAPIRef("tabs.ungroup()")}} methods instead. To query the position of a tab group within a window, use {{WebExtAPIRef("tabs.query()")}}. These APIs in the `tabs` namespace don't require any permissions.

Expand Down Expand Up @@ -45,7 +45,7 @@ To use this API, an extension must request the `"tabGroups"` [permission](/en-US
- {{WebExtAPIRef("tabGroups.onCreated")}}
- : Fires when a tab group is created.
- {{WebExtAPIRef("tabGroups.onMoved")}}
- : Fires when a tab group is moved, within a window or to another window.
- : Fires when a tab group is moved within a window or to another window.
- {{WebExtAPIRef("tabGroups.onRemoved")}}
- : Fires when a tab group is removed.
- {{WebExtAPIRef("tabGroups.onUpdated")}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ browser-compat: webextensions.api.tabGroups.onMoved

{{AddonSidebar}}

Fires when a tab group is moved, within a window or to another window. {{WebExtAPIRef("tabs.onMoved")}} also fire for the tabs within the group.
Fires when a tab group is moved within a window or to another window. {{WebExtAPIRef("tabs.onMoved")}} also fire for the tabs within the group.

The event is passed a {{WebExtAPIRef("tabGroups.TabGroup")}} object. This includes the `windowId` but not the position of the tab group. To determine the position of the tab group, use {{WebExtAPIRef("tabs.query()")}} with the `groupId`, and read the `index` property of the returned tab.

In Chrome, this event doesn't fire when a tab group is moved between windows; instead, the group is removed from one window and created in another (firing {{WebExtAPIRef("tabGroups.onRemoved")}} and {{WebExtAPIRef("tabGroups.onCreated")}}.

## Syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ browser-compat: webextensions.api.tabGroups.onUpdated

{{AddonSidebar}}

Fires when a tab group is updated.
Fires when a tab group's state changes.

This event does not fire when the group's membership changes or when a tab group is moved. Those updates are covered by {{WebExtAPIRef("tabs.onUpdated")}} and {{WebExtAPIRef("tabGroups.onMoved")}} respectively.

To detect `windowId` changes, use {{WebExtAPIRef("tabGroups.onMoved")}} instead.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: tabGroups.tabGroup
slug: Mozilla/Add-ons/WebExtensions/API/tabGroups/tabGroup
title: tabGroups.TabGroup
slug: Mozilla/Add-ons/WebExtensions/API/tabGroups/TabGroup
page-type: webextension-api-type
browser-compat: webextensions.api.tabGroups.tabGroup
browser-compat: webextensions.api.tabGroups.TabGroup
---

{{AddonSidebar}}
Expand Down
Loading