PHANTOM
🇮🇳 IN
Skip to content

Fix pinned tab visibility on insertion in vertical tab#34206

Draft
simonhong wants to merge 3 commits intomasterfrom
invisible_new_pinned_tab
Draft

Fix pinned tab visibility on insertion in vertical tab#34206
simonhong wants to merge 3 commits intomasterfrom
invisible_new_pinned_tab

Conversation

@simonhong
Copy link
Member

@simonhong simonhong commented Feb 26, 2026

Resolves brave/brave-browser#53083

BraveTabContainer::ShouldTabBeVisible() was checking data().pinned to decide
whether a pinned tab should always be visible.
During tab insertion (restore, duplicate, etc.), SetData() has not been called yet when
ShouldTabBeVisible() runs, so newly inserted pinned tabs were incorrectly treated as unpinned and hidden.

IsPinned() combines data().pinned with a model-based fallback: when data().pinned is false,
it checks the tab's index in tabs_view_model_ against layout_helper_->GetPinnedTabCount(),
both of which are already accurate because AddTabToViewModel() runs before StartInsertTabAnimation().
Use IsPinned() in both ShouldTabBeVisible() and StartInsertTabAnimation().

TEST=VerticalTabStripStripBrowserTest.PinnedTabVisibilityAfterRestore

Use layout_helper_->GetPinnedTabCount() instead of data().pinned in
StartInsertTabAnimation() to determine if a tab is pinned. The tab's
data has not been set yet at this point in the insertion flow
(TabStrip::AddTabsAt calls AddTabs before SetData), so data().pinned
is always false for newly inserted tabs. This caused restored pinned
tabs to receive unpinned-width initial bounds, resulting in incorrect
icon positioning and missing favicons.

Fix brave/brave-browser#53083
Add RestoredPinnedTabHasCorrectBoundsAndIcon browser test to verify
that closing a pinned tab and restoring it via chrome::RestoreTab()
in vertical tab mode results in correct pinned-width bounds and a
visible favicon icon.

Fix brave/brave-browser#53083
@simonhong simonhong self-assigned this Feb 26, 2026
@simonhong simonhong changed the title Fixed new pinned tab is not visible Fixed new pinned tab is not visible in vertical tab Feb 26, 2026
@simonhong simonhong changed the title Fixed new pinned tab is not visible in vertical tab Fix pinned tab visibility on insertion in vertical tab Feb 26, 2026
@simonhong simonhong force-pushed the invisible_new_pinned_tab branch from 1bfc608 to 0ca148d Compare February 26, 2026 12:35
@brave-builds
Copy link
Collaborator

Warning

You have got a presubmit warning. Please address it if possible.

A banned pattern was used.
    browser/ui/views/frame/vertical_tabs/vertical_tab_strip_browsertest.cc:1012:
      Do not use this method. It is invoked half-way through the destructor of WebContentsImpl and using it often results in crashes or surprising behavior. Conceptually, this is only necessary by objects that depend on, but outlive the WebContents. These objects should instead coordinate with the owner of the WebContents which is responsible for destroying the WebContents.

@github-actions
Copy link
Contributor

Chromium major version is behind target branch (145.0.7632.120 vs 146.0.7680.32). Please rebase.

@github-actions github-actions bot added the chromium-version-mismatch The Chromium version on the PR branch does not match the version on the target branch label Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chromium-version-mismatch The Chromium version on the PR branch does not match the version on the target branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vertical tabs: favicon missing on restored pinned tab after Ctrl+W / Ctrl+Z

3 participants