-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(react-menu, react-positioning): update maxSize to prevent double scrollbar for Menu in small viewport #28622
feat(react-menu, react-positioning): update maxSize to prevent double scrollbar for Menu in small viewport #28622
Conversation
📊 Bundle size reportUnchanged fixtures
|
Perf Analysis (
|
Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
---|---|---|---|---|---|
Avatar | mount | 600 | 584 | 5000 | |
Button | mount | 304 | 299 | 5000 | |
Field | mount | 1063 | 1045 | 5000 | |
FluentProvider | mount | 630 | 641 | 5000 | |
FluentProviderWithTheme | mount | 73 | 68 | 10 | |
FluentProviderWithTheme | virtual-rerender | 62 | 61 | 10 | |
FluentProviderWithTheme | virtual-rerender-with-unmount | 69 | 71 | 10 | |
InfoButton | mount | 11 | 13 | 5000 | |
MakeStyles | mount | 859 | 848 | 50000 | |
Persona | mount | 1644 | 1608 | 5000 | |
SpinButton | mount | 1337 | 1295 | 5000 |
apps/vr-tests-react-components/src/stories/Menu/ScrollableMenuSmallViewport.stories.tsx
Show resolved
Hide resolved
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 3789163:
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: e7e522f452c4090c7f4426082efac571e8141a8e (build) |
packages/react-components/react-menu/src/components/MenuItem/useMenuItemStyles.styles.ts
Show resolved
Hide resolved
/azp run |
No commit pushedDate could be found for PR 28622 in repo microsoft/fluentui |
Fix 1.a in #28623.
Previous Behavior
A menu in small viewport needs

autoSize
to become scrollable. But if the menu has scrollable menu group inside, it can show double scrollbar:https://codesandbox.io/s/blue-framework-mstvsn?file=/example.tsx
The expected behavior is to shrink the scrollable menu group to fit the entire menu in the viewport.
But this is hard to achieve from user side: the MenuPopover has maxHeight added by autoSize. But MenuList can still overflow MenuPopover even when it has style
height: 100%
. This is because height percentage is based on theheight
value of the parent element, but the parent MenuPopover has onlymaxHeight
.New Behavior
The changes:
autoSize
modifier, addheight
/width
when overflow happens. SetoverflowX
/overflowY
toauto
only when overflow happens.height: 100%
on MenuList when it is inside Menu context.