Skip to content

fix(collection-header): Added Horizontal Scroll On CollectionHeader to avoid overlapping and squeezing of contents - #8511

Merged
utkarsh-bruno merged 2 commits into
usebruno:mainfrom
ravindra-bruno:fix/bru-3741
Jul 10, 2026

Conversation

@ravindra-bruno

@ravindra-bruno ravindra-bruno commented Jul 7, 2026 •

Copy link
Copy Markdown
Collaborator

…ollable header actions
JIRA

Description

The Problem

UI Overlap: When a user opens the AI panel, it completely overlaps or hides the Environment Switcher and Configuration controls, making it impossible to manage environment variables or toggle configs at the same time.

Broken Responsiveness: At smaller window sizes, the collection header bar does not adapt gracefully to the restricted screen real estate. Instead of wrapping, collapsing, or scaling down, the layout breaks and becomes cluttered and difficult to navigate.

The Solution

  1. Fixing the AI Panel Behavior (Layout Flex/Grid):
  • Shift the layout from an absolute overlay to a responsive grid/flex container. Opening the AI panel should squeeze or push the main workspace content rather than covering critical header controls like the Environment Switcher.
  • If screen space is explicitly too small for a side-by-side view, implement a proper drawer mechanism that shifts focus or gracefully pushes elements out of the way, ensuring key navigation points remain accessible.
  1. Making the Collection Header Responsive:
  • Introduce a CSS Media Query or dynamic flex-wrap rule for smaller viewport breakpoints.
  • On smaller windows, elements in the collection header bar should either gracefully wrap into a second row, or overflow into a "More Options" (three-dot ...) dropdown menu to clean up the cluttered layout.

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • New Features

    • The AI chat sidebar can now be resized by dragging its edge, with the chosen width saved for future sessions.
    • Header actions in collection headers now scroll horizontally when space is limited, helping keep controls accessible on smaller screens.
  • Bug Fixes

    • Improved sidebar and header layout behavior to better handle narrow windows and overflow without breaking alignment.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds resizable width support to the AI Chat Sidebar via a drag handle, with localStorage-backed width persistence and a resize overlay during dragging. Separately, updates the CollectionHeader's header actions container to allow horizontal scrolling with a hidden scrollbar.

Changes

AI Chat Sidebar Resize

Layer / File(s) Summary
Resize styles and constants
packages/bruno-app/src/components/AiChatSidebar/StyledWrapper.js, packages/bruno-app/src/components/AiChatSidebar/index.js
Adds CSS for a draggable resize handle and full-screen resize overlay, plus localStorage key/constants, clamping, and a helper to read the stored sidebar width.
Drag-to-resize state and behavior
packages/bruno-app/src/components/AiChatSidebar/index.js
Introduces sidebarWidth, isResizing state and a ref, wires mouse-driven drag handlers to compute and clamp width live, persists the final width on mouseup, and renders the drag handle and overlay with the dynamic width applied.

Collection Header Actions Overflow

Layer / File(s) Summary
Header actions overflow styling
packages/bruno-app/src/components/RequestTabs/CollectionHeader/StyledWrapper.js, packages/bruno-app/src/components/RequestTabs/CollectionHeader/index.js
Adds .header-actions CSS for horizontal auto-scroll with hidden scrollbar and non-shrinking children, and applies the new class to the header actions wrapper <div>.

Estimated code review effort: 2 (Simple) | ~15 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant DragHandle
  participant AiChatSidebar
  participant localStorage

  User->>DragHandle: mousedown
  DragHandle->>AiChatSidebar: handleResizeMouseDown (isResizing=true)
  AiChatSidebar->>AiChatSidebar: attach mousemove/mouseup listeners
  User->>AiChatSidebar: mousemove (drag)
  AiChatSidebar->>AiChatSidebar: compute clamped width, update state
  User->>AiChatSidebar: mouseup
  AiChatSidebar->>localStorage: persist final width
  AiChatSidebar->>AiChatSidebar: remove listeners
Loading

Suggested reviewers: helloanoop, bijin-bruno, lohit-bruno, naman-bruno

Poem

A rabbit tugs the sidebar's edge,
Just wide enough, right on the ledge,
Saved in storage, snug and tight,
Header actions scroll just right,
Hop, resize, and code delight! 🐇↔️

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the header-actions horizontal scrolling change, though it omits the AI sidebar resize portion.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
packages/bruno-app/src/components/AiChatSidebar/index.js (2)

446-479: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Drag handle needs to reclamp against window size on next drag, but persisted width isn't reclamped on mount.

readStoredSidebarWidth clamps against fixed MIN/MAX bounds but not against window.innerWidth. If a user persists a wide sidebar (e.g. 720px) on a large monitor, then opens the app on a smaller window, the sidebar renders at the stale width until the next drag recalculates upperBound. Consider applying the same window.innerWidth - 360 cap at mount/read time too.

The setSidebarWidth(next) flag from static analysis on line 462 is a false positive — next is a freshly computed value, not derived from the previous state.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bruno-app/src/components/AiChatSidebar/index.js` around lines 446 -
479, The persisted AI sidebar width is only clamped to the static min/max
bounds, so it can render too wide when the window is smaller on mount. Update
the initial width loading path in AiChatSidebar, especially
readStoredSidebarWidth and the state initialization around
sidebarWidth/sidebarWidthRef, to apply the same window.innerWidth - 360 cap used
in handleMouseMove. Keep the resize logic in handleResizeMouseDown/useEffect
unchanged except for reusing a shared clamp helper so the mounted width and
drag-time width stay consistent.

806-814: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Drag handle is not keyboard-operable despite role="separator".

The handle uses role="separator" aria-orientation="vertical", which implies the ARIA window-splitter pattern — that pattern expects the element to be focusable (tabIndex={0}) with keyboard resize support (arrow keys) and aria-valuenow/aria-valuemin/aria-valuemax. As-is, keyboard-only users cannot resize the panel at all.

Also missing data-testid for Playwright testability on this new interactive element.

♿ Suggested improvement
       <div
         className={`ai-sidebar-drag-handle ${isResizing ? 'is-dragging' : ''}`}
         onMouseDown={handleResizeMouseDown}
         role="separator"
         aria-orientation="vertical"
         aria-label="Resize AI panel"
+        tabIndex={0}
+        aria-valuenow={sidebarWidth}
+        aria-valuemin={MIN_AI_SIDEBAR_WIDTH}
+        aria-valuemax={MAX_AI_SIDEBAR_WIDTH}
+        data-testid="ai-sidebar-drag-handle"
+        onKeyDown={(e) => {
+          if (e.key === 'ArrowLeft') setSidebarWidth((w) => clampSidebarWidth(w + 10));
+          if (e.key === 'ArrowRight') setSidebarWidth((w) => clampSidebarWidth(w - 10));
+        }}
       >
As per coding guidelines, "Add `data-testid` to testable elements for Playwright."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bruno-app/src/components/AiChatSidebar/index.js` around lines 806 -
814, The AI panel drag handle in AiChatSidebar is exposed as a separator but
isn’t keyboard-operable or test-friendly. Update the draggable element in the
resize handle markup to be focusable and support the splitter pattern by adding
keyboard resize handling plus the required aria-valuemin, aria-valuemax, and
aria-valuenow state, and include a data-testid for Playwright. Use the existing
handleResizeMouseDown / isResizing logic as the anchor for the new keyboard
interaction and accessibility attributes.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/bruno-app/src/components/AiChatSidebar/index.js`:
- Around line 446-479: The persisted AI sidebar width is only clamped to the
static min/max bounds, so it can render too wide when the window is smaller on
mount. Update the initial width loading path in AiChatSidebar, especially
readStoredSidebarWidth and the state initialization around
sidebarWidth/sidebarWidthRef, to apply the same window.innerWidth - 360 cap used
in handleMouseMove. Keep the resize logic in handleResizeMouseDown/useEffect
unchanged except for reusing a shared clamp helper so the mounted width and
drag-time width stay consistent.
- Around line 806-814: The AI panel drag handle in AiChatSidebar is exposed as a
separator but isn’t keyboard-operable or test-friendly. Update the draggable
element in the resize handle markup to be focusable and support the splitter
pattern by adding keyboard resize handling plus the required aria-valuemin,
aria-valuemax, and aria-valuenow state, and include a data-testid for
Playwright. Use the existing handleResizeMouseDown / isResizing logic as the
anchor for the new keyboard interaction and accessibility attributes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 69282cb8-0d87-485d-9752-087a2cf3bd86

📥 Commits

Reviewing files that changed from the base of the PR and between 4592d2c and 8b6a423.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/AiChatSidebar/StyledWrapper.js
  • packages/bruno-app/src/components/AiChatSidebar/index.js
  • packages/bruno-app/src/components/RequestTabs/CollectionHeader/StyledWrapper.js
  • packages/bruno-app/src/components/RequestTabs/CollectionHeader/index.js

@utkarsh-bruno utkarsh-bruno left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you resolve the merge conflicts too

@pull-request-size pull-request-size Bot added size/S and removed size/L labels Jul 10, 2026
@ravindra-bruno ravindra-bruno changed the title fix(collection-header): resizable AI panel width and horizontally scr… fix(collection-header): Added Horizontal Scroll On CollectionHeader to avoid overlapping and squeezing of contents Jul 10, 2026
@utkarsh-bruno
utkarsh-bruno merged commit c1cfdfd into usebruno:main Jul 10, 2026
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants