Skip to content

Respect kShowNever when side panel opens#33769

Open
orpheuslummis wants to merge 1 commit intobrave:masterfrom
orpheuslummis:fix/hide-sidebar-control-with-show-never
Open

Respect kShowNever when side panel opens#33769
orpheuslummis wants to merge 1 commit intobrave:masterfrom
orpheuslummis:fix/hide-sidebar-control-with-show-never

Conversation

@orpheuslummis
Copy link

Summary

When "Show Sidebar" is set to Never in brave://settings/appearance, opening a side panel extension (or built-in panel like Bookmarks) no longer forces the sidebar control strip (icon bar) to appear. Only the panel content is shown.

Resolves brave/brave-browser#51271

The Problem

ShowSidebarAll() unconditionally showed both the control view (icon strip) and the side panel, ignoring kShowNever. This forced a two-column layout (icon strip + panel) even when the user explicitly disabled the sidebar, wasting horizontal space—especially painful on smaller displays or when using side panel extensions like Claude or Page Sidebar.

Changes

All changes are in sidebar_container_view.cc/h (+ browsertest):

Touch Point What Changed
ShowSidebar() New bool show_sidebar_control parameter (default true) controls whether the icon strip is shown alongside the panel
ShowSidebarAll() Now checks kShowNever before passing show_control — hides icon strip when sidebar is disabled
CalculatePreferredSize() Fixed early return that bailed when control was hidden, even if the panel was visible (returned {0,0} → panel got zero space)
Layout() Zeroes control_view_width when control is not visible (follows existing IsFullscreenForCurrentEntry() pattern)
SetSidebarShowOption() When switching to kShowNever while a panel is open, hides just the control view and keeps the panel

No changes to kShowAlways or kShowOnMouseOver behavior — all existing code paths are unaffected.

Verified Scenarios

Scenario Result
kShowNever + extension opens panel Panel only, no strip
kShowNever + built-in item opens panel Panel only, no strip
kShowNever + panel closes Everything hides
kShowAlways + panel opens (regression check) Both visible (unchanged)
kShowOnMouseOver + panel opens (regression check) Both visible (unchanged)
Switch Always→Never mid-panel Strip hides, panel stays
Switch Never→Always mid-panel Strip reappears
Animation (show/hide/interruption) Correct in all cases
CalculatePreferredSize / Layout Correct for all visibility combos

Known Limitation

BraveContentsViewUtil::GetRoundedCornersForContentsView checks IsSidebarVisible() (which reports control-view visibility). In kShowNever+panel mode, the content area's lower corner on the panel side uses the window-corner radius instead of the border radius. This is cosmetic only and suitable for a follow-up.

Test Plan

  • Added ShowNeverHidesControlViewWhenPanelOpens browsertest
  • Added SwitchToShowNeverWhilePanelOpen browsertest
  • Manual: Set "Show Sidebar" to Never → open a side panel extension → verify only panel shows, no icon strip
  • Manual: With panel open, toggle "Show Sidebar" between Always/Never → verify control strip appears/disappears correctly
  • Manual: Close panel in Never mode → verify everything hides cleanly
  • Verify existing SidebarContainerViewBrowserTest tests still pass

When "Show Sidebar" is set to "Never" in brave://settings/appearance,
opening a side panel extension (or built-in panel) no longer forces the
sidebar control strip (icon bar) to appear. Only the panel content is
shown, matching the user's preference.

Previously, ShowSidebarAll() unconditionally showed both the control
view and the side panel, ignoring the kShowNever setting. This was
reported as a UX issue for users who want side panel extensions
(e.g., Claude, Page Sidebar) without the redundant icon strip.

Changes:
- ShowSidebar() accepts a new show_sidebar_control parameter
- ShowSidebarAll() checks kShowNever before showing control view
- CalculatePreferredSize() handles panel-only visible state
- Layout() zeroes control width when control view is hidden
- SetSidebarShowOption(kShowNever) hides control if panel is open

Known limitation: BraveContentsViewUtil rounded corner radius on the
panel-adjacent side uses window radius instead of border radius in
kShowNever+panel mode (cosmetic only, suitable for follow-up).

Resolves brave/brave-browser#51271
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Desktop] Feature Request: Option to hide Brave Sidebar when using Side Panel extensions

1 participant