Repository navigation
Improve DropdownMenu responsive fit and presentation guidance - #5395
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsBottomSheet (@astryxdesign/core) · View in Storybook
ContextMenu (@astryxdesign/core) · View in Storybook
DropdownMenu (@astryxdesign/core) · View in Storybook
MoreMenu (@astryxdesign/core) · View in Storybook
MultiSelector (@astryxdesign/core) · View in Storybook
Selector (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual RegressionStatus: Skipped — Broad stable scope is deferred to the daily release gate. It covers 3136 trusted baseline shots instead of recapturing them for this PR. View the report Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
|
I ran the three new readiness stories against the PR base ( Before/after screenshot comparison (Pixelcloud) Concrete results:
The Pixelcloud asset is linked rather than embedded so the full-resolution comparison opens separately. [Reviewed by Agentcloud] |
There was a problem hiding this comment.
This PR is a net improvement, and I found no regressions or bugs that should block merging.
Three non-blocking follow-ups:
- Clarify that
menuWidthstrings support CSS length/percentage/math values such as240px,50vw,calc(...), andclamp(...); intrinsic and automatic keywords are outside the intended contract. - Apply the intended viewport gutter consistently to horizontally positioned menus.
- Make custom-width caps fully safe-area-aware.
Validation passed: 111 focused DropdownMenu tests, full workspace build, strict lint, and Storybook typecheck.
|
Fixed the blocking
Validation: 117 focused tests pass; Core typecheck, strict changed-file lint, and the Core production build pass. |
679ec07 to
ddb8ad7
Compare
xinzi-bot
left a comment
There was a problem hiding this comment.
I rechecked exact head 1949245. The adaptive examples look fine, but the prior controlled close issue still reproduces in source: prop-driven isMenuOpen={false} skips setOpen(false), so submenuPath is not cleared and reopening can start in the old submenu. Please reset the path whenever effective open state becomes false.
[Automated review]
|
Fixed the controlled-close navigation issue in 3171300. Bottom-sheet navigation now clears whenever the effective open state transitions to false, including prop-driven closes, and a regression test covers drill in → controlled close → reopen at the root. The focused DropdownMenu suite passes (90 tests) and the touched files pass ESLint. |
xinzi-bot
left a comment
There was a problem hiding this comment.
Exact head 3171300 fixes the controlled close issue; the test covers close-then-reopen at root. @imdreamrunner, this looks ready for your approval.
[Automated review]
* Improve DropdownMenu responsive fit and presentation guidance * fix DropdownMenu scroll region keyboard access * docs clarify compact submenu presentations * fix DropdownMenu anchor alignment and submenu examples * fix DropdownMenu submenu spacing * docs minimize DropdownMenu guidance diff * fix(DropdownMenu): preserve intrinsic width values * feat: add adaptive menu presentations * chore: version packages for v0.5.1 (#5661) * refactor(i18n): pre-build lookup map for translations (#4696) * fix(popover): improve responsive fit and focus * Preserve Popover compatibility when constraining overflow * Add real-viewport Popover overflow stories * Refine Popover overflow story * Restore Popover story dismissal behavior * docs clarify Popover presentation guidance * docs render Popover evidence in real viewports * fix(Popover): address accessibility review * fix DropdownMenu controlled close navigation * fix(Popover): observe overflow only while open * fix(Popover): align mobile presentation behavior * docs(Popover): tighten bottom sheet spacing * fix(menu): align mobile bottom sheets * fix(Popover): hide container focus outline * fix(ContextMenu): prevent touch selection * docs(ContextMenu): add bottom sheet example * fix(MoreMenu): preserve touch feedback * docs(MoreMenu): add bottom sheet example * fix(ContextMenu): reliably suppress touch selection * fix(ContextMenu): improve mobile doc examples * fix(MoreMenu): reduce bottom sheet padding * refactor(menu): share adaptive sheet infrastructure * fix(menu): preserve focus without touch rings * fix(BottomSheet): keep browser edge surface-colored * fix(ContextMenu): drill into sheet submenus * Add adaptive Selector and MultiSelector presentations (#5685) * feat: add adaptive selector presentations * fix: refine selector bottom sheet interactions * refactor(selector): use shared adaptive policy * fix(selector): preserve focus without touch rings * fix selectors bottom sheet focus target --------- Co-authored-by: Cindy Zhang <[email protected]> Co-authored-by: Li Hongzhang <[email protected]>
Problem
DropdownMenu uses
usePopoverdirectly, so Popover's viewport-fitting work does not automatically apply here. The current menu can reach or exceed the browser edge when a consumer requests a widemenuWidth, and submenu flyouts own the same separate geometry. The fixed 300px menu height is also not aware of a shorter visual viewport.The presentation guidance also needs to distinguish two contracts without turning either into a universal rule:
Core DropdownMenu does not automatically change presentation.
Changes and rationale
100vh/100vwfallbacks preserve older-browser behavior.overflow: autoturns fitting menus into scroll containers and can clip content unnecessarily; a scroll region with only programmatically focusable menu items fails keyboard access checks.tabIndex={-1}; oversized menus scroll internally with overscroll containment and usetabIndex={0}while open. Tab still follows the existing menu dismissal behavior.menuWidthas a minimum width, capped by available space.menuWidthasmin-width, despite docs calling it a fixed/custom width. Changing it to exact width would be an undocumented compatibility break.DropdownMenuSubMenu.play. Root menus preserve the trigger edge; concise submenus flip with a measured 4px gap; hierarchy that cannot fit uses a separate explicit drill-in BottomSheet example.Research boundaries
Research informed these conclusions:
Primary references: WCAG Reflow, WCAG Target Size (Minimum), WAI-ARIA Menu Button Pattern, Material 3 Menus, Material 3 Bottom Sheets, Apple HIG Menus, and React Aria Menu.
Responsive and Interaction Readiness
overflow: visible.Compatibility and scope
menuWidthretains its existing minimum-width behavior.Validation
pnpm exec vitest run packages/core/src/DropdownMenu/DropdownMenu.test.tsx packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx packages/core/src/DropdownMenu/DropdownMenuSelectable.test.tsx— 111 tests passpnpm -F @astryxdesign/core buildpnpm -F @astryxdesign/storybook typecheckpnpm check:repo218–358px, child flips to74–214px, preserving a measured 4px gapoverflow-y: visibleoverflow-y: auto