Skip to content

fix(dropdown): flip-up menu collapses off-screen (follow-up to #59)#60

Merged
KucharczykL merged 1 commit into
mainfrom
fix/issue-39-dropdown-clipped
Jun 20, 2026
Merged

fix(dropdown): flip-up menu collapses off-screen (follow-up to #59)#60
KucharczykL merged 1 commit into
mainfrom
fix/issue-39-dropdown-clipped

Conversation

@KucharczykL

Copy link
Copy Markdown
Owner

Follow-up to #59, which fixed the dropdown clipping but introduced a flip-up regression.

Problem

When a dropdown toggle sits near the viewport bottom, the menu must flip up. In that branch the code cleared inline top with "" — which let the menu's top-[105%] utility class reassert top: 105% on the now-position:fixed element. With bottom also set, the box collapsed to a 2px sliver below the viewport, so toggles near the bottom appeared not to open at all.

The open-down path worked only because it sets inline top explicitly, overriding the class. The original e2e only exercised open-down, so this slipped through.

Measured before (viewport 760, bottom rows): menu top:798 bottom:800 height:2.

Fix

Set the unused anchor to "auto" instead of "" so the inline value wins over the top-[105%] class:

if (openUp) { menu.style.top = "auto";    menu.style.bottom = `${innerHeight - rect.top}px`; }
else        { menu.style.bottom = "auto"; menu.style.top    = `${rect.bottom}px`; }

After fix: flip-up rows open upward, fully on-screen (heights 407–542px).

Tests

Added test_device_dropdown_flips_up_near_viewport_bottom (scrolls so lower rows sit near the viewport bottom, asserts the menu is a real on-screen box, not a sliver). make check green (536 tests).

🤖 Generated with Claude Code

The flip-up branch cleared inline `top` to "", which let the menu's
`top-[105%]` utility class reassert top:105% on the now-fixed element —
collapsing the menu to a 2px sliver below the viewport, so toggles near the
viewport bottom appeared not to open. Set the unused anchor to "auto" so the
inline value wins over the class. Add an e2e regression for the flip-up path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

@KucharczykL KucharczykL merged commit b7d667a into main Jun 20, 2026
4 checks passed
@KucharczykL KucharczykL deleted the fix/issue-39-dropdown-clipped branch June 20, 2026 21:50
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.

1 participant