Add "close other tabs" button to tab page menu. - #6799
Open
and0p wants to merge 1 commit into
Open
Conversation
and0p
requested review from
Williamrai,
cooltey,
dbrant and
voyagerfan
as code owners
August 16, 2026 03:34
There was a problem hiding this comment.
Pull request overview
Adds a “Close other tabs” action to preserve the active article while removing other open tabs.
Changes:
- Adds menu and confirmation UI strings.
- Removes all inactive tabs and updates the tab list.
- Provides an Undo snackbar restoring closed tabs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
strings.xml |
Adds action, confirmation, and feedback strings. |
menu_tabs.xml |
Adds the new overflow-menu item. |
TabActivity.kt |
Implements tab removal and Undo behavior. |
Suppressed comments (1)
app/src/main/java/org/wikipedia/page/tabs/TabActivity.kt:202
- The insertion position assumes the retained tab is still present. While this snackbar is visible, the user can close that last tab and then tap this Undo action; the adapter then has zero items, so notifying an insertion starting at position 1 can trigger RecyclerView inconsistency/IndexOutOfBounds errors. Capture the current adapter item count before restoring the tabs and use it as the insertion position (normally 1, but 0 after the retained tab was closed).
binding.tabRecyclerView.adapter?.notifyItemRangeInserted(1, otherTabs.size)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| openNewTab() | ||
| true | ||
| } | ||
| R.id.menu_close_other_tabs -> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this do?
Adds a "close other tabs" button to the tab page menu:
Tested and working on Android 16. Undo works as expected.
Did not add integration tests as
ArticleTabTestseems to be broken by explore feed changes at the moment. I may try to address that in a separate PR and update this one.I have only added strings in English.
Why is this needed?
The Phabricator ticket has a good summary.
I have also been wanting this for a couple years. I often find myself opening a Wikipedia link, seeing that I have 70+ tabs open, and then not being able to close them all without also losing the page I am on.
(It might also be nice to have this in the toolbar when looking at the article itself, but then it would need to make sense with the "customize toolbar" feature that allows actions to be pinned to the bottom of the screen at all times.)
Phabricator:
https://phabricator.wikimedia.org/T395550