Repository navigation
fix(collection-header): Added Horizontal Scroll On CollectionHeader to avoid overlapping and squeezing of contents - #8511
Conversation
…ollable header actions
WalkthroughAdds 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. ChangesAI Chat Sidebar Resize
Collection Header Actions Overflow
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
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
packages/bruno-app/src/components/AiChatSidebar/index.js (2)
446-479: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueDrag handle needs to reclamp against window size on next drag, but persisted width isn't reclamped on mount.
readStoredSidebarWidthclamps against fixed MIN/MAX bounds but not againstwindow.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 recalculatesupperBound. Consider applying the samewindow.innerWidth - 360cap at mount/read time too.The
setSidebarWidth(next)flag from static analysis on line 462 is a false positive —nextis 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 winDrag 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) andaria-valuenow/aria-valuemin/aria-valuemax. As-is, keyboard-only users cannot resize the panel at all.Also missing
data-testidfor Playwright testability on this new interactive element.As per coding guidelines, "Add `data-testid` to testable elements for Playwright."♿ 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)); + }} >🤖 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
📒 Files selected for processing (4)
packages/bruno-app/src/components/AiChatSidebar/StyledWrapper.jspackages/bruno-app/src/components/AiChatSidebar/index.jspackages/bruno-app/src/components/RequestTabs/CollectionHeader/StyledWrapper.jspackages/bruno-app/src/components/RequestTabs/CollectionHeader/index.js
utkarsh-bruno
left a comment
There was a problem hiding this comment.
Can you resolve the merge conflicts too
…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
Contribution Checklist:
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
Bug Fixes