Repository navigation
fix(ui): keep popup and context menus inside the window (T-3) - #28
Conversation
Dropdowns, the menubar and submenus placed their menus with shad's manual ShadAnchor, which never moves an overlay back onto the screen: the sheet tab menu ran off the bottom edge and start-aligned menus off the right. WonkyMenuPlacement turns those anchors into auto anchors that open on the other side of the trigger when the menu does not fit and shift sideways at the window edges; menus taller than the room beside their trigger or pointer scroll. Write's own popup host is replaced by WonkyPopupMenuHost, and dropdown-like popovers anchored with ShadAnchor use the same placement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Wonky task review: T-3: Some popup menus are partially outside of the screen.The pull request perfectly implements the acceptance criteria by introducing a unified auto-anchoring logic (
Scope: Tests: Added. 13 widget tests were added that thoroughly cover edge positioning, tall menus, submenus, and theme colors. Specs: Updated. The Facts
Reviewed commit |
Wonky-Task: T-3
Wonky-Claim: 7HXN-WEKE
Fixes popup and context menus that ran partially off the screen (board report #3).
Cause:
WonkyDropdownMenuand the menubar placed their menus with shad's manualShadAnchor, which glues an overlay to its trigger and never moves it back onto the screen. Context menus flipped above the pointer but ran off the bottom when they were taller than the room on both sides.Fix: a shared
WonkyMenuPlacementinwonky_ui(spec 02 §4.2):WonkyMenuPlacement.onScreen(ShadAnchor)turns a manual anchor into an auto anchor that opens where the anchor says when it fits, on the other side of the trigger (gap mirrored) when it does not, and shifts sideways at the window edges.buildWonkyMenuItems(maxHeight:): menus taller than the larger side of their trigger or pointer scroll, so they always fit on one side.WonkyDropdownMenu,WonkyMenubar, submenus (beside their item, or ending level with its bottom),WonkyContextMenuRegionandWonkyPopupMenuHost.WonkyPopupMenuHost. Dropdown-likeShadPopovers anchored with a rawShadAnchor(Drive and board search, notifications, the pivot Add field list) use the same placement.Acceptance criteria
wonky_ui(WonkyDropdownMenu,WonkyMenubar, submenus,WonkyContextMenuRegion,WonkyPopupMenuHost), so it applies across Sheets, Slides, Write, Drive and the shell. App code changed only where it bypassed the shared placement.popoversurface colour.Tests
packages/wonky_ui/test/widgets/menu_placement_test.dart(13 tests). The edge, tall-menu and submenu cases fail on the old code.wonky_uipasses in full.wonky_app, Write, Sheets, Slides and Drive pass with-x golden. Goldens are Linux-CI only, and none of them opens a menu.🤖 Generated with Claude Code