Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,19 @@ Moves one or more tabs to a new position in the same window or to a different wi

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

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.
In Chrome, moving a tab away from the other tab in a split view removes the split view. This behavior may change in a future release.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this to a note below so that we introduce the split view behavior and only after that clarify that Chrome's behavior differs. I image that when the implementation changes that we want to document the standard behavior first and then have a note about older versions.


When tabs associated with a split view are moved:

- 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.
- 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.
- When only one of the tabs in a split view is moved:
- In Chrome, moving a tab away from the other tab in the split view removes the split view. Otherwise, the tabs are re-ordered as necessary.
- In Firefox, the other tab is moved to preserve the split view. The tabs are re-ordered if necessary.
> [!NOTE]
> 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 to preserve the split view and the order of the tabs is unchanged.

See also [Working with tab split views](/en-US/docs/Mozilla/Add-ons/WebExtensions/Working_with_the_Tabs_API#working_with_tab_split_views).

## Syntax

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ If any of the tabs are:
- part of a split view, the split view is removed.
- the last tab in a group, the group is removed.

See also [Working with tab groups](/en-US/docs/Mozilla/Add-ons/WebExtensions/Working_with_the_Tabs_API#working_with_tab_groups) and [Working with tab split views](/en-US/docs/Mozilla/Add-ons/WebExtensions/Working_with_the_Tabs_API#working_with_tab_split_views).

## Syntax

```js-nolint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ sidebar: addonsidebar

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.

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

- Permissions needed to use the Tabs API.
- Discovering more about tabs and their properties using {{WebExtAPIRef("tabs.query")}}.
- Creating, duplicating, moving, updating, reloading, and removing tabs.
- Manipulating a tab's zoom level.
- Manipulating a tab's CSS.
- Manipulating tab groups and split views.

We then conclude by looking at some other, miscellaneous features offered by the API.
The article concludes by looking at some other, miscellaneous features offered by the API.

> [!NOTE]
> 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).
Expand Down Expand Up @@ -553,6 +554,31 @@ Let's walk through how it's set up.
});
```

## Working with tab groups

Tab functionality enables users to create [group tabs](https://support.mozilla.org/en-US/kb/tab-groups).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I asked for a "split views" article because we don't have a better place to offer an overview of its capability and describe it.

For tab groups, the tabGroups API reference serves that purpose, and is linked from various places such as https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab#groupid

Can we use that as the canonical place for the description of what tab groups are instead of linking to SUMO here (that SUMO article is already linked from tabGroups MDN page).


Various tab methods enable you to work with the content of groups, including:

- {{WebExtAPIRef("tabs.group")}} and {{WebExtAPIRef("tabs.ungroup")}} to create or remove groups.
- {{WebExtAPIRef("tabs.move")}} to move tabs within, into, or out of a group.
- {{WebExtAPIRef("tabs.remove")}} to close tabs in a group, and close the group if the tab was the last one in the group

> [!NOTE]
> Features to work with a tab group are provided in {{WebExtAPIRef("tabGroups")}}.

## Working with tab split views
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted in the comment above I asked for a split view section to have a canonical place to document the split view concept. Can we link here instead of to SUMO in other places in the doc? Basically #43576 but then linking here instead of SUMO.


Tab functionality lets display two tabs side-by-side in a [split view](https://support.mozilla.org/en-US/kb/split-view-firefox).

Various tab methods enable you to work with the content of groups and split views, including:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add text offering the following overview of relevant details. I am asking for this so we have one place where a dev can learn at once what they should do if they want to work with split views:

  • split view consists of exactly two adjacent tabs
  • when an individual tab of a split is moved, the other tab in the split moves with it to preserve the split (the emphasis here is to show that conceptually the pair of tabs in a split view should be regarded as one unit). The moved tab that moves along can be observed with tabs.onMoved.
  • when a tab is removed, the other tab in the split remains but is no longer part of a split view
  • given a tab, whether it is a member of a split view can be seen through its splitViewId property (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab#splitviewid ). Split view membership changes can be observed through tabs.onUpdated


- {{WebExtAPIRef("tabs.move")}} to move tabs within or out of a split view.
- {{WebExtAPIRef("tabs.remove")}} to close a tab in a split view, which closes the split view.

> [!NOTE]
> 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).

## Some other interesting abilities

There are a couple of other Tabs API features that don't fit into one of the earlier sections:
Expand Down
4 changes: 4 additions & 0 deletions files/en-us/mozilla/firefox/releases/150/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ Firefox 150 is the current [Beta version of Firefox](https://www.firefox.com/en-

## Changes for add-on developers

- The behavior of {{WebExtAPIRef("tabs.move")}} is updated for split views so that:
- The order of tabs in a split view can be swapped. ([Firefox bug 2016762](https://bugzil.la/2016762))
- 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))

<!-- ### Removals -->

<!-- ### Other -->
Expand Down
Loading