Skip to content

Commit 8bc9881

Browse files
rebloorgithub-actions[bot]Rob--W
authored
Release 150 tab split view functionality (mdn#43589)
* Release 150 tab split view functionality * linter nits * Apply suggestions from review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Rob Wu <rob@robwu.nl> * Feedback updates * joined lines * Apply suggestions from @Rob--W Co-authored-by: Rob Wu <rob@robwu.nl> * Feedback updates, including: - removing working with tab groups from working with the tabs API article and adding additional details to the tabGroups API overview. - adding additional details to the working with split tabs in the working with the tabs API article - adding links to the working with split tabs section in the working with the tabs ID article - rewording the information about moving a tab in a split view * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * nits --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Rob Wu <rob@robwu.nl>
1 parent 6ee50f3 commit 8bc9881

File tree

10 files changed

+44
-11
lines changed

10 files changed

+44
-11
lines changed

files/en-us/mozilla/add-ons/webextensions/api/tabgroups/index.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ This API enables extensions to modify and rearrange [tab groups](https://support
1010

1111
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.
1212

13-
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.
13+
The `tabGroups` API doesn't offer the ability to create, alter, or remove tab groups. Use:
14+
15+
- {{WebExtAPIRef("tabs.group")}} and {{WebExtAPIRef("tabs.ungroup")}} to create or remove groups.
16+
- {{WebExtAPIRef("tabs.move")}} to move tabs within, into, or out of a group.
17+
- {{WebExtAPIRef("tabs.remove")}} to close tabs in a group, and close the group if the tab was the last one in the group.
18+
- {{WebExtAPIRef("tabs.query")}} to query the position of a tab group within a window.
19+
20+
These APIs in the `tabs` namespace don't require any permissions.
1421

1522
## Permissions
1623

files/en-us/mozilla/add-ons/webextensions/api/tabs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Many tab operations use a Tab `id`. Tab `id`s are guaranteed to be unique to a s
5050
- {{WebExtAPIRef("tabs.TAB_ID_NONE")}}
5151
- : A special ID value given to tabs that are not browser tabs (for example, tabs in devtools windows).
5252
- {{WebExtAPIRef("tabs.SPLIT_VIEW_ID_NONE")}}
53-
- : A special ID value given to tabs that aren't in a split view.
53+
- : A special ID value given to tabs that aren't in a [split view](/en-US/docs/Mozilla/Add-ons/WebExtensions/Working_with_the_Tabs_API#working_with_tab_split_views).
5454

5555
## Functions
5656

files/en-us/mozilla/add-ons/webextensions/api/tabs/move/index.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ Moves one or more tabs to a new position in the same window or to a different wi
1010

1111
You can only move tabs to and from windows whose {{WebExtAPIRef('windows.WindowType', 'WindowType')}} is `"normal"`.
1212

13-
When the call moves a tab or tabs in a split view, Firefox moves the tabs in the split view together to preserve the split view. In Chrome, moving a tab away from the other tab in a split view removes the split view.
13+
When tabs associated with a [split view](/en-US/docs/Mozilla/Add-ons/WebExtensions/Working_with_the_Tabs_API#working_with_tab_split_views) are moved:
14+
15+
- When both tabs in a split are specified and they remain adjacent but their order is changed, the tabs are swapped in the split view.
16+
- When both tabs in a split view are specified but are separated by one or more tabs, the tabs are moved and the split view removed.
17+
- When only one of the tabs in a split view is moved:
18+
- In Firefox, the other tab is moved to preserve the split view. The tabs are re-ordered if necessary.
19+
> [!NOTE]
20+
> In Firefox 149 only, when a call moves a tab or tabs in a split view, the tabs in the split view are moved together, but the order of the tabs is unchanged.
21+
- In Chrome, moving a tab away from the other tab in the split view removes the split view. (This behavior may change in a future release.) Otherwise, the tabs are re-ordered as necessary.
1422

1523
## Syntax
1624

files/en-us/mozilla/add-ons/webextensions/api/tabs/onupdated/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Lists the changes to the state of the tab that is updated. To learn more about t
108108
- `pinned` {{optional_inline}}
109109
- : `boolean`. The tab's new pinned state.
110110
- `splitViewId` {{optional_inline}}
111-
- : `integer`. The ID of the split view the tab belongs to. Set to {{WebExtAPIRef('tabs.SPLIT_VIEW_ID_NONE')}} when the tab doesn't belong to a split view.
111+
- : `integer`. The ID of the [split view](/en-US/docs/Mozilla/Add-ons/WebExtensions/Working_with_the_Tabs_API#working_with_tab_split_views) the tab belongs to. Set to {{WebExtAPIRef('tabs.SPLIT_VIEW_ID_NONE')}} when the tab doesn't belong to a split view.
112112
- `status` {{optional_inline}}
113113
- : `string`. The status of the tab. Can be either _loading_ or _complete_.
114114
- `title` {{optional_inline}}

files/en-us/mozilla/add-ons/webextensions/api/tabs/query/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ let querying = browser.tabs.query(queryInfo)
4949
- `pinned` {{optional_inline}}
5050
- : `boolean`. Whether the tabs are pinned.
5151
- `splitViewId` {{optional_inline}}
52-
- : `integer`. The ID of the split view the tab belongs to. Set to {{WebExtAPIRef('tabs.SPLIT_VIEW_ID_NONE')}} to query the tabs that don't belong to a split view.
52+
- : `integer`. The ID of the [split view](/en-US/docs/Mozilla/Add-ons/WebExtensions/Working_with_the_Tabs_API#working_with_tab_split_views) the tab belongs to. Set to {{WebExtAPIRef('tabs.SPLIT_VIEW_ID_NONE')}} to query the tabs that don't belong to a split view.
5353
- `status` {{optional_inline}}
5454
- : {{WebExtAPIRef('tabs.TabStatus')}}. Whether the tabs have completed loading.
5555
- `title` {{optional_inline}}

files/en-us/mozilla/add-ons/webextensions/api/tabs/remove/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Closes one or more tabs.
1010

1111
If any of the tabs are:
1212

13-
- part of a split view, the split view is removed.
14-
- the last tab in a group, the group is removed.
13+
- part of a [split view](/en-US/docs/Mozilla/Add-ons/WebExtensions/Working_with_the_Tabs_API#working_with_tab_split_views), the split view is removed.
14+
- the last tab in a {{WebExtAPIRef("tabGroups","group")}}, the group is removed.
1515

1616
## Syntax
1717

files/en-us/mozilla/add-ons/webextensions/api/tabs/split_view_id_none/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ browser-compat: webextensions.api.tabs.SPLIT_VIEW_ID_NONE
66
sidebar: addonsidebar
77
---
88

9-
A special ID value given to tabs that aren't in a split view.
9+
A special ID value given to tabs that aren't in a [split view](/en-US/docs/Mozilla/Add-ons/WebExtensions/Working_with_the_Tabs_API#working_with_tab_split_views).
1010

1111
Its value is `-1`.
1212

files/en-us/mozilla/add-ons/webextensions/api/tabs/tab/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Values of this type are objects. They contain the following properties:
6565
- `sessionId` {{optional_inline}}
6666
- : `string`. The session ID used to uniquely identify a `Tab` obtained from the {{WebExtAPIRef('sessions')}} API.
6767
- `splitViewId` {{optional_inline}}
68-
- : `integer`. The ID of the split view the tab belongs to. Set to {{WebExtAPIRef('tabs.SPLIT_VIEW_ID_NONE')}} when the tab doesn't belong to a split view.
68+
- : `integer`. The ID of the [split view](/en-US/docs/Mozilla/Add-ons/WebExtensions/Working_with_the_Tabs_API#working_with_tab_split_views) the tab belongs to. Set to {{WebExtAPIRef('tabs.SPLIT_VIEW_ID_NONE')}} when the tab doesn't belong to a split view.
6969
- `status` {{optional_inline}}
7070
- : `string`. Either _loading_ or _complete_.
7171
- `successorTabId` {{optional_inline}}

files/en-us/mozilla/add-ons/webextensions/working_with_the_tabs_api/index.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ sidebar: addonsidebar
77

88
Tabs let a user open several web pages in their browser window and then switch between those web pages. With the Tabs API, you can work with and manipulate these tabs to create utilities that provide users with new ways to work with tabs or to deliver the features of your extension.
99

10-
In this how-to article we'll look at:
10+
This how-to article look at:
1111

1212
- Permissions needed to use the Tabs API.
1313
- Discovering more about tabs and their properties using {{WebExtAPIRef("tabs.query")}}.
1414
- Creating, duplicating, moving, updating, reloading, and removing tabs.
1515
- Manipulating a tab's zoom level.
1616
- Manipulating a tab's CSS.
17+
- Manipulating tab groups and [split views](#working_with_tab_split_views).
1718

18-
We then conclude by looking at some other, miscellaneous features offered by the API.
19+
The article concludes by looking at some other, miscellaneous features offered by the API.
1920

2021
> [!NOTE]
2122
> There are some Tab API features covered elsewhere. These are the methods you can use to manipulate tab content with scripts ({{WebExtAPIRef("tabs.connect")}}, {{WebExtAPIRef("tabs.sendMessage")}}, and {{WebExtAPIRef("tabs.executeScript")}}). If you want more information on these methods, see the Concepts article [Content scripts](/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts) and the how-to guide [Modify a web page](/en-US/docs/Mozilla/Add-ons/WebExtensions/Modify_a_web_page).
@@ -553,6 +554,19 @@ Let's walk through how it's set up.
553554
});
554555
```
555556
557+
## Working with tab split views
558+
559+
Tab functionality lets users display two tabs, side-by-side in a [split view](https://support.mozilla.org/en-US/kb/split-view-firefox).
560+
561+
In the UI, a split view is treated as one unit, so that when someone moves a tab in a split, the other tab in the split moves with it, preserving the split. Your extension can observe the moved tab using {{WebExtAPIRef("tabs.onMoved")}}. The split behavior is the same when moving one tab in the split with {{WebExtAPIRef("tabs.move")}}. However, specifying both split tabs in a move and placing a tab between them closes the split.
562+
563+
When someone closes one of the tabs in a split, the split view closes and the other tab remains. Your extension can remove a split's tab using {{WebExtAPIRef("tabs.remove")}}.
564+
565+
Your extension can find out if a tab is in a split view using its [`splitViewId`](/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab#splitviewid). Split view membership changes are observed using {{WebExtAPIRef("tabs.onUpdated")}}.
566+
567+
> [!NOTE]
568+
> APIs to enable the creation and removal of split views (without moving or removing the tabs) are being developed under [issue #967](https://github.com/w3c/webextensions/issues/967) of W3C's WebExtensions Community Group (WECG).
569+
556570
## Some other interesting abilities
557571

558572
There are a couple of other Tabs API features that don't fit into one of the earlier sections:

files/en-us/mozilla/firefox/releases/150/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ Firefox 150 is the current [Beta version of Firefox](https://www.firefox.com/en-
8181

8282
## Changes for add-on developers
8383

84+
- The behavior of {{WebExtAPIRef("tabs.move")}} is updated for split views so that:
85+
- The order of tabs in a split view can be swapped. ([Firefox bug 2016762](https://bugzil.la/2016762))
86+
- When the list of tabs includes both split view tabs and places one or more tabs between them, the tabs are moved apart and the split view closed. ([Firefox bug 2022549](https://bugzil.la/2022549))
87+
8488
<!-- ### Removals -->
8589

8690
<!-- ### Other -->

0 commit comments

Comments
 (0)