hotfix(v3.1.9): render chat header dropdowns in a portal so they can't be clipped - #262
Conversation
The chat provider/model/reasoning dropdown menus are absolutely positioned and lived inside the chat popup, whose root has `overflow: hidden`. The 3.1.8 hotfix only lifted the clip on the `.chat-header-pills` row (fixing downward clipping), but the two right-hand pills' menus still overran the 400px popup's right edge and were cut off by the popup root's overflow. Render the popover through a React portal to <body> with viewport (fixed) coordinates, plus edge-shift (pull back inside the viewport) and flip-up (open above when there's no room below), with the list capped to available height and scrolling internally. No ancestor overflow can clip it now. Visual design is unchanged. Bump ClawBox 3.1.8 -> 3.1.9 so boxes detect and pull the fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 54 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughChangesDropdown positioning
Package release metadata
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant HeaderDropdown
participant TriggerElement
participant ViewportEvents
participant document.body
HeaderDropdown->>TriggerElement: Read bounding geometry
HeaderDropdown->>ViewportEvents: Register resize and capture-phase scroll listeners
HeaderDropdown->>HeaderDropdown: Compute constrained coordinates
HeaderDropdown->>document.body: Render fixed popover through portal
ViewportEvents->>HeaderDropdown: Trigger coordinate recomputation
Possibly related PRs
Suggested reviewers: 🚥 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 |
🦀 ClawReviewPoked my eyestalks out for this one. Quick tour: Follow-up to the v3.1.8 hotfix (#261): where that PR lifted downward clipping on the chat header pill row, this one catches the remaining right-edge overflow on the Model and Reasoning menus by rendering the popover through a React portal directly to with fixed viewport coordinates. Edge-shift, flip-up, and auto-height capping ensure the popover stays fully on-screen regardless of where the chat window is positioned. Bumps the version to 3.1.9 so customer devices pull the fix via auto-update. At a glance
Good to know
— ClawReview 🦀. I set the scene; CodeRabbit reviews the code; you decide. Conventions: docs. |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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.
Inline comments:
In `@src/components/HeaderDropdown.tsx`:
- Line 96: Replace the misleading Math.min(maxDesired, 160) expression in the
HeaderDropdown positioning condition with the constant threshold 160, or a
clearly named equivalent such as minPreferredHeight; leave the surrounding
spaceBelow and spaceAbove logic unchanged.
- Around line 70-114: Add targeted coverage in the e2e chat popup spec for the
positioning logic in HeaderDropdown’s useLayoutEffect: force a constrained
viewport or trigger position that exercises both vertical flip-above and
horizontal left-shift behavior, then verify the dropdown remains within the
viewport. Keep the existing basic open/select coverage unchanged.
- Around line 70-114: Throttle the HeaderDropdown useLayoutEffect recomputation
by wrapping compute() in a requestAnimationFrame scheduler that coalesces resize
and capture-phase scroll events into one update per frame. Ensure the scheduled
frame is canceled during effect cleanup and preserve the existing initial
computation and coordinate calculations.
- Around line 169-184: Add a stable unique id to the portaled listbox rendered
by HeaderDropdown and set the trigger button’s aria-controls to that same id,
while preserving the existing aria-haspopup and open-state behavior. Update the
relevant trigger and popover markup so assistive technologies can associate them
despite the portal.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 30e5b730-9106-446f-8b81-38e1ad361457
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
package.jsonsrc/components/HeaderDropdown.tsx
437e6c6 to
5c5d471
Compare
Problem
The chat provider/model/reasoning dropdown menus are absolutely positioned and lived inside the chat popup, whose root has
overflow: hidden. The 3.1.8 hotfix (#261) only lifted the clip on the.chat-header-pillsrow (fixing downward clipping), but the two right-hand pills' menus still overran the 400px popup's right edge and were cut off by the popup root's overflow — so the Model and Reasoning dropdowns appeared broken while Provider looked fine.Fix
Render the popover through a React portal to
<body>with viewport (fixed) coordinates, plus:No ancestor
overflowcan clip it now. Visual design is unchanged.Bumps ClawBox 3.1.8 → 3.1.9 so boxes detect and pull the fix (tag
v3.1.9pushed).Testing
bun run test— 1429/1429 pass🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests
Chores