Skip to content

fix(ui): caret dropdown clipped by overflow:hidden ancestors#52

Closed
schroldgames wants to merge 1 commit into
amirlehmam:masterfrom
schroldgames:fix/caret-dropdown-clipped
Closed

fix(ui): caret dropdown clipped by overflow:hidden ancestors#52
schroldgames wants to merge 1 commit into
amirlehmam:masterfrom
schroldgames:fix/caret-dropdown-clipped

Conversation

@schroldgames

Copy link
Copy Markdown
Contributor

Fixes the bug documented in #34 (the dropdown is invisible due to clipping). This is a targeted fix without the broader toolbar redesign also proposed in that issue.

Root cause

The new-tab type menu (▾ caret next to +) renders position: absolute; top: 30px inside .surface-tab-bar, but three ancestor elements have overflow: hidden:

  • .surface-tab-bar (28px tall — the menu immediately clips below it)
  • .pane-wrapper__content
  • .split-child

z-index has no effect on overflow: hidden clipping. The click and state toggle work correctly — the menu is just never visible.

Fix

Render the dropdown via createPortal at document.body with position: fixed + coordinates from getBoundingClientRect(). This escapes all parent clipping contexts entirely.

The outside-click handler is also tightened to exclude the caret button itself, preventing a mousedown-then-click double-toggle flicker when dismissing the menu by clicking the caret again.

What this does not include

The SVG icon redesign and Layout split-button proposed in #34 are intentionally out of scope — those are a separate presentational change. This PR only fixes the clipping bug so the existing menu actually works.

🤖 Generated with Claude Code

The new-tab type menu (▾ caret next to +) was silently clipped by
overflow:hidden on .surface-tab-bar, .pane-wrapper__content, and
.split-child, making it appear that the button did nothing.

Render the dropdown via createPortal at document.body with
position:fixed + coordinates from getBoundingClientRect(), so it
escapes all parent clipping contexts. The outside-click handler is
updated to exclude the caret button itself, preventing the
mousedown-then-click double-toggle flicker.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kevmtt

kevmtt commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

I fixed and reworked the design in this PR: #38

@amirlehmam

Copy link
Copy Markdown
Owner

Thanks @schroldgames — your diagnosis here is spot-on: three overflow: hidden ancestors clip the absolutely-positioned menu, and z-index can't escape a clipping context.

Closing as superseded, because we landed the exact same fix via a different PR: #38 (shipped in v0.8.8) renders the new-tab/Layout dropdowns through createPortal to document.body with position: fixed + getBoundingClientRect() coords — identical root-cause fix to yours — as part of the broader icon-toolbar redesign that closes #34. #43 then layers a shell picker into those portal-rendered menus, and adds the same outside-click/right-edge-flip hardening you called out.

So the clipping bug is fixed in 0.8.8; your standalone targeted version would now conflict with the redesigned SurfaceTabBar.tsx. Really appreciate the clean writeup — and your #48 and #51 both shipped in this same release. 🙏

@amirlehmam amirlehmam closed this Jun 20, 2026
@schroldgames schroldgames deleted the fix/caret-dropdown-clipped branch June 20, 2026 15:16
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.

3 participants