Skip to content
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

New tab not opened if a New Tab button is clicked at the first instance when only pinned tabs are available in vertical tab view #43656

Closed
3 of 6 tasks
MadhaviSeelam opened this issue Jan 31, 2025 · 5 comments · Fixed by brave/brave-core#27477

Comments

@MadhaviSeelam
Copy link

MadhaviSeelam commented Jan 31, 2025

Description

Found while testing #43375. Created all pinned tabs in a vertical tab view. Pressed New Tab button (and other ways Pressed +, Ctrl + T) to open a new tab but the new tab is not shown in the vertical tab view although page refreshed/animated. However new tabs opened subsequently after pressing New Tab button. Works as expected if there is at least one unpinned tab

Steps to reproduce

  1. Install1.75.172
  2. launch Brave
  3. open few tabs
  4. enabled vertical view
  5. pin all of the tabs
  6. press New Tab button

Actual result

Nothing happens. No new tab opened.

2025-01-31_09h53_57.mp4

Expected result

Tabs should be opened at the first instance when there are only pinned tabs.

2025-01-31_10h11_02.mp4

Reproduces how often

Easily reproduced

Brave version (brave://version info)

Brave 1.75.172 Chromium: 133.0.6943.39 (Official Build) (64-bit)
Revision 92995c24e269fce1f4da632a4f0462458474866e
OS Windows 11 Version 24H2 (Build 26100.2894)

Channel information

  • release (stable)
  • beta
  • nightly

Reproducibility

  • with Brave Shields disabled
  • with Brave Rewards disabled
  • in the latest version of Chrome

Miscellaneous information

@rebron @simonhong

CC: @brave/qa-team

@MadhaviSeelam MadhaviSeelam changed the title New tab not opened if a New Tab button is clicked beneath all pinned tabs in vertical tab view in the initial instance New tab not opened if a New Tab button is clicked at the first instance when only pinned tabs are available in vertical tab view Jan 31, 2025
@rebron rebron added the priority/P3 The next thing for us to work on. It'll ride the trains. label Jan 31, 2025
@simonhong
Copy link
Member

checking.

@simonhong
Copy link
Member

Found more bug scenarios from same reason.

STR 1.

  1. Turn on vertical tab mode
  2. Open one window(A) and make it have one unpinned tab
  3. Open another window(B) and make it have one pinned tab
  4. Move window B's pinned tab to window A via pinned tab's context menu (Move tab to another window)
  5. window B's pinned tab is moved to window A but it's not visible in window A

STR2.

  1. Turn on vertical tab mode
  2. Open one window(A) and make it have one unpinned tab
  3. Open another window(B) and make it have one pinned tab
  4. Move window A's unpinned tab to window B via pinned tab's context menu (Move tab to another window)
  5. window A's unpinned tab is moved to window B but it's not visible in window B

@simonhong simonhong moved this to In progress in General Feb 3, 2025
@simonhong
Copy link
Member

simonhong commented Feb 3, 2025

Our VerticalTabStripRegionView tries to re-layout both tab containers(pin & unpin) when it gets child's preferred size changed noti.
However, upstream doesn't give that noti when first tab is added.

Tab* TabContainerImpl::AddTab(std::unique_ptr<Tab> tab,
                              int model_index,
                              TabPinned pinned) {
  // First add the tab to the view model, this is done because AddChildView sets
  // some tooltip information which tries to calculate the hit test, which needs
  // information about its adjacent tabs which it gets from the view model.
  AddTabToViewModel(tab.get(), model_index, pinned);
  Tab* tab_ptr = AddChildView(std::move(tab));
  OrderTabSlotView(tab_ptr);

  // Don't animate the first tab, it looks weird, and don't animate anything
  // if the containing window isn't visible yet.
  if (GetTabCount() > 1 && GetWidget() && GetWidget()->IsVisible()) {
    StartInsertTabAnimation(model_index);
  } else {
    CompleteAnimationAndLayout();
  }

  return tab_ptr;
}

Because of that our vertical tab strip doesn't re-layout when first tab is added to any tab containers.
So, we have other buggy scenario mentioned above(#43656 (comment)).

To fix it, trying to give noti in that situation like below. but it gets another startup crashing.
If there is one initial tab, startup goes well and below this issue is fixed.

Tab* BraveTabContainer::AddTab(std::unique_ptr<Tab> tab,
                               int model_index,
                               TabPinned pinned) {
  Tab* new_tab = TabContainerImpl::AddTab(std::move(tab), model_index, pinned);
  if (GetWidget() && GetWidget()->IsVisible() && GetVisible() &&
      GetTabCount() == 1) {
    PreferredSizeChanged();
  }
  return new_tab;
}

simonhong added a commit to brave/brave-core that referenced this issue Feb 4, 2025
fix brave/brave-browser#43656

So far, we only do re-layout vertical tab strip when it gets child's preferred size
changed noti. However, upstream doesn't give it for first tab. See
TabContainerImpl::AddTab() for more detail. We optimized like that to avoid redundant
re-layout but we need to relayout whenever child view's layout is invalidated.
That constraints was added to fix brave/brave-browser#28967
but confirmed that it doesn't happen anymore w/o this constraints.
@github-project-automation github-project-automation bot moved this from In progress to Completed in General Feb 4, 2025
@brave-builds brave-builds added this to the 1.77.x - Nightly milestone Feb 4, 2025
@kjozwiak
Copy link
Member

kjozwiak commented Feb 5, 2025

The above requires 1.75.175 or higher for 1.75.x verification 👍

@GeetaSarvadnya
Copy link

GeetaSarvadnya commented Feb 6, 2025

Verification PASSED on

Brave | 1.75.175 Chromium: 133.0.6943.54 (Official Build) (64-bit)
-- | --
Revision | 8e82be95a27b2e442e0099307c0c8ad6d12adcf0
OS | Windows 10 Version 22H2 (Build 19045.5440)
  • Reproduced the issue on 1.75.174 Chromium: 133.0.6943.54 
  • Verified the STR from the description on 1.75.175 Chromium: 133.0.6943.54 and ensured that click on new tab + opens up the new tab vertical tab bar when all the tabs are pinned.

Image

Cases_PASSED

STR 1.

  1. Turn on vertical tab mode
  2. Open one window(A) and make it have one unpinned tab
  3. Open another window(B) and make it have one pinned tab
  4. Move window B's pinned tab to window A via pinned tab's context menu (Move tab to another window)
  5. window B's pinned tab is moved to window A but it's not visible in window A

Confirmed that Pinned tab from Window B moved to Window A is shown on Windows A

Image

STR2.

  1. Turn on vertical tab mode
  2. Open one window(A) and make it have one unpinned tab
  3. Open another window(B) and make it have one pinned tab
  4. Move window A's unpinned tab to window B via pinned tab's context menu (Move tab to another window)
  5. window A's unpinned tab is moved to window B but it's not visible in window B

Confirmed that unpinned tab from window A is visible in window B

Image

@GeetaSarvadnya GeetaSarvadnya added QA/In-Progress Indicates that QA is currently in progress for that particular issue QA Pass-Win64 labels Feb 6, 2025
@LaurenWags LaurenWags removed the QA/In-Progress Indicates that QA is currently in progress for that particular issue label Feb 6, 2025
@rebron rebron removed this from General Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants