Repository navigation
Conversation
Deploy previewBundle size
PerformanceNo regressions in 32 benchmarks · precise to ±10.3% (±20.7% at worst) · ran 3m 44s · details Check out the code infra dashboard for more information about this PR. |
b8d5972 to
905a982
Compare
|
Nice work @LukasTy. Some comments/questions: Open questions1. Context menu: does it need its own component? I’m inclined to ship a separate component, as Base UI's ContextMenu gives us touch long-press. 2. Accessibility: what is still ours IMO existing color contrast problems should be fixed globally and not per component i.e. I assume the problematic interactive states without 3:1 contrast are present in other parts of the library. 3. Other defaults These seem fine, as they’re Base UI’s defaults. 4. SSR, 'use client', ref typing Is there a benefit narrowing the refs' types? If so, could we narrow the refs per part and type 5. How much Base UI shows through I think a facade makes more sense as we can be able to filter out certain non-supported features (e.g. detached triggers?). Today, 6. The tint of an open submenu parent Same comment as point number 2. Is this problem present in other existing components? If so, it’s good to have it into account but in case it informs the API, but if it’s something to be fixed at a global level I wouldn’t tackle in this component if it deviates from the rest of the library. 7. The collapsed trigger API duplicates the Base UI item registration Q: Is there intention to support detached triggers? Is there intention to ship a Menubar component? Fable 5.1 came up with this:
Other
|
|
Thanks for the thorough pass, @aarongarciah. 🙏 Open questions
Other
|
siriwatknp
left a comment
There was a problem hiding this comment.
Went through the branch with a focus on the Base UI boundary, read the Base UI menu source side by side.
The conformance pilot and the Grow adapter look solid to me.
The keyboard bridge and the explicit Menu2SubmenuTrigger match how Base UI works internally, both are the right calls.
I also tried an alternative for the shared styles: layered nameless styled components instead of exported style objects.
See LukasTy#2, it targets this branch.
It removes the three *Styles modules and the getMenuItemRootStyles(theme, classes, options) signature.
Verified with tsc, eslint, 350 unit tests, and a Pigment CSS transform fixture.
Main open point: the shared base styles the highlight through [data-highlighted], which touches the Mui-* classes contract.
Curious what you think.
siriwatknp
left a comment
There was a problem hiding this comment.
Did a styles and visuals pass on the deploy preview (Chrome, real pointer and keyboard input).
Visual parity holds. I measured computed styles on the Classic vs successor section: same elevation 8 shadow, radius, list padding 8px 0, item height 36px with 6px 16px padding, same selected tint rgba(25, 118, 210, 0.08), same disabled opacity 0.38, same popup width. The only differences are the intended ones (div list vs ul, collision-aware max-height).
One behavior issue found, inline comment below.
Great idea! 👍 |
Measure again against the merge base 3d18274. The classic Menu now grows only by the shared ModalManager scroll lock. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Item render functions now receive the Base UI state of their part, as groups, labels, and separators already do. The Material props stay in ownerState. Each part exports a Menu2*State alias for its render state. The RFC lists the render state shape as an open question for the team. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Menu2Popup and Menu2SubmenuPopup take render for the menu surface. It keeps the Paper, theme, and sx styles, and slots.root takes precedence. The render function receives the Base UI popup state. slotProps.root no longer accepts component, so render is the only way to change the surface element. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The slotProps callbacks and the theme callbacks now get the props and the live Base UI state in their types, which matches the runtime owner state. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Base UI reads the aria-label of a popup render element and the id of a portal render element. Menu2 hides these elements behind its render functions, so it now lifts both. The group label also registers the id of its render element. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An item press close no longer focuses the trigger when onOpenChange moved focus out of the menu tree, as in Base UI. finalFocus shares the same rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A classic MenuItem throws inside MenuPopup, and other classic components get no menu behavior. The upgrade guide, menu2.md, and the RFC now state the rule, and the customized demo uses startAdornment. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Tell React 17 users to set a trigger id from the first render for openOnHover. - Say that a classic MenuItem also throws through render, and use a router link as the render example. - Add a classic Menu + unstable_enhanceDensity case to the bundle script, and measure again against the merge base 9769f52. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| const transitionTimeout = | ||
| transitionDuration === 'auto' && | ||
| !(TransitionSlot as (React.ElementType & { muiSupportAuto?: boolean | undefined }) | null) | ||
| ?.muiSupportAuto | ||
| ? undefined | ||
| : transitionDuration; |
There was a problem hiding this comment.
Is there a reason transitionDuration={0} still shows the starting style for one frame?
From what I tested, the first frame after opening has opacity: 0 and scale(0.75, 0.5625), and the menu becomes visible on the next frame.
Classic Menu with the same prop is fully visible on the first frame:
<Menu2Popup transitionDuration={0}>
<Menu2Item>One</Menu2Item>
</Menu2Popup>The docs say "Set transitionDuration={0} to remove the animation." so I'd expect the same result as classic Menu.
slots={{ transition: null }} works fine.
| ...(!theme.focusVisible && { | ||
| [`&.${buttonBaseClasses.focusVisible}`]: { | ||
| backgroundColor: (theme.vars || theme).palette.action.focus, | ||
| }, |
There was a problem hiding this comment.
The docs suggest a theme variant for the highlighted state (Shared theme styles), but a variant with backgroundColor has no visible effect:
createTheme({
components: {
MuiMenu2Item: {
styleOverrides: {
root: {
variants: [
{ props: { highlighted: true }, style: { backgroundColor: 'pink' } },
],
},
},
},
},
});With keyboard navigation the item has both Mui-focusVisible and MuiMenu2Item-highlighted, and the background stays action.focus.
&.Mui-focusVisible here has higher specificity than a root-level variant. Adding '&.Mui-focusVisible' inside the variant makes it work (right side):
Maybe use :where() like Menu2SubmenuTriggerRootSlot does, so that the variant wins?
Also, the docs give three ways to style this state: the highlighted variant, .Mui-focusVisible (State data attributes), and .MuiMenu2Item-highlighted in the upgrade guide (focusVisibleClassName row). Please keep one that works and show it as an example.
| @@ -396,6 +471,77 @@ export default function enhanceHighContrast< | |||
| ], | |||
| }, | |||
| }, | |||
| MuiMenu2Item: { | |||
There was a problem hiding this comment.
Not sure if this is in scope, but in forced colors the menu popup has no visible edge. The browser removes the shadow, and the popup background is the same Canvas color as the page, so it's hard to see where the menu starts.
Classic Menu and Popover have the same gap, so it's not a regression. Since this PR already adds Menu2 rules here, how about an outline for the popups too?
I tried it as a theme override on top of enhanceHighContrast (right side):
Could be something like:
MuiMenu2Popup: {
...c?.MuiMenu2Popup,
styleOverrides: {
...c?.MuiMenu2Popup?.styleOverrides,
root: [
c?.MuiMenu2Popup?.styleOverrides?.root,
{ [HCM]: { outline: `1px solid ${hcTokens.buttonBorder}` } },
],
},
},and the same for MuiMenu2SubmenuPopup.
| The examples use local names such as `Menu` and `MenuItem`. | ||
| The import paths, theme keys, and CSS classes keep their `Menu2` names. | ||
|
|
||
| Build each menu only from these parts. |
There was a problem hiding this comment.
Menu v2 doesn't cover filtering (Menu.FilterProvider, Menu.Input, Menu.List, Menu.Empty) from @base-ui/react 1.9.0.
I think it's fine to leave it out since it's still a preview in Base UI, just noting it for later.
For reference, a text field inside MenuPopup doesn't work today because typeahead takes the typed characters. The Base UI parts do work inside MenuPopup from what I tested, but the input is unstyled.
| | :---------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `autoFocus` | Delete it. | | ||
| | `dense` | Delete it. Menu v2 has no dense mode. | | ||
| | `selected` | For one current value, use `MenuRadioItem` inside a `MenuRadioGroup`, and add `closeOnClick` to close the menu on selection. For independent toggles, use `MenuCheckboxItem`. See [Update the items](#6-update-the-items). | |
There was a problem hiding this comment.
Please mention that radio items add an indicator column. From what I tested, following this row on a classic menu with icons gives two leading icons per item (radio + icon), and the label moves from 52px to 88px:
Using the icon as the indicator keeps the layout, maybe worth showing here:
<MenuRadioItem value="copy" icon={<ContentCopy />} checkedIcon={<ContentCopy />}>
Copy
</MenuRadioItem>Also, the role changes from menuitem to menuitemradio. It's an improvement, but screen readers announce it differently, so please mention it in this row too.
| ## Max height menu | ||
|
|
||
| The menu limits its height to the viewport and to the space available at the anchor, and scrolls its content. | ||
| To set a smaller limit with the `sx` prop on `MenuPopup`, use `min(320px, var(--available-height))` to keep it within short screens. |
There was a problem hiding this comment.
Matching the popup width to the trigger is a common customization (select-like menus, split buttons), so I think it needs a demo.
From what I tested, --anchor-width already works but the docs don't mention it:
<MenuPopup sx={{ minWidth: 'var(--anchor-width)' }}>It also keeps matching when the trigger resizes:
var(--available-height) here is also the only popup CSS variable the docs mention. Please list the others with the demo, like Base UI's Positioner CSS Variables: --anchor-width, --anchor-height, --available-width, --available-height, --transform-origin.
| - Give `MenuPopup` an accessible name with `aria-label` or `aria-labelledby`. | ||
| - Pass `finalFocus` to `MenuPopup` to return focus to the element when the menu closes. Otherwise, focus can move to an unrelated element. `finalFocus` does not move focus from an element outside the menu, for example from a field in a Dialog that an item opens. | ||
|
|
||
| This wiring does not provide the keyboard behavior of `MenuTrigger`. |
There was a problem hiding this comment.
Is it expected that Tab doesn't close a menu without a trigger? From what I tested, focus goes to a hidden focus guard, then the page body, then the anchor button, and the menu stays open the whole time (left: without a trigger, right: with MenuTrigger):
With MenuTrigger, and with the classic Menu that this section compares to (anchorEl), Tab closes the menu. Plain Base UI without a trigger behaves the same as Menu2, so it comes from Base UI.
Since Menu2 already owns the modal layer, maybe it can close on focus out here too. Otherwise, please mention it in this section next to the other keyboard differences.
There was a problem hiding this comment.
Following up: plain Base UI with a detached trigger (Menu.createHandle) closes on Tab as expected. So the gap here comes from Menu2 not supporting handles yet, and this section is the only way to anchor to an outside element.
Maybe point to MenuTrigger first in this section, since it works anywhere inside Menu, and keep this pattern for anchors that can't be a trigger.
| // The popup has no full-screen Modal. Limit its height to the viewport | ||
| // and the space available at the anchor, not to its parent's height. | ||
| maxHeight: 'min(calc(100vh - 96px), var(--available-height))', | ||
| overflowY: 'auto', |
There was a problem hiding this comment.
In a scrolling menu, Home and End hide the list padding. From what I tested, Home leaves scrollTop at 8 and End stops 8px short, so the first and last items touch the popup edge. The classic Menu keeps the padding visible:
Is it worth matching classic here? scrollPaddingBlock: 8 on this root fixes it from what I tested, but it repeats the list padding value, so I'm also fine leaving it to users with sx.
- Run the AccountMenu2 and PositionedMenu2 regression demos only on React 18 and later. These demos call React.useId. - Give the e2e Account menu fixture a static trigger id. Remove the DocsLayout fixture and its tests: Stack now uses CSS gap, and the focus guards use fixed positions, so the trigger cannot move. - Upgrade guide step 7: copy the theme keys, and keep MuiMenu and MuiMenuItem while the app uses Select, TablePagination, or a classic Menu. - RFC: add the theme types as open question 3, and remove the claims that call them settled. Remove the span advice for a Tooltip on a disabled item. Co-Authored-By: Claude Opus 5.5 <[email protected]>








Adds Menu v2, an unstable Base UI-backed successor to Material UI Menu, with submenu support. This PR builds on #48663 by @mj12albert. It is not ready for release.
Docs and RFC
Please add API and usage comments on
docs/data/material/components/menu2/menu2.mdanddocs/data/material/migration/upgrade-to-menu-v2/upgrade-to-menu-v2.mdin this PR.Changes since the last review
2d07df256areplaces the single-component API. Review comments before this commit can name props and classes that no longer exist.Menu2Triggerreplaces thetriggerprop andslotProps.trigger. It requiresrenderwith an element or a typed callback. Both trigger components now takeopenOnHover,delay, andcloseDelaydirectly, as in Base UI. ThenativeButtonprop also belongs on the trigger.render. It changes the element or composes a component while keeping Material styles, theme overrides, and item ripple.slots.rootandslotProps.root. A replacement root takes precedence overrenderand can omit Material styles. It still receives Base UI behavior props, refs, utility classes, and children. Forward these to preserve behavior and accessibility. AslotProps.rootcallback receives the owner state: the props and the live Base UI state, or only the props on popups. Items must forward children to keep indicators and, withrender, ripple.Menu2andMenu2Submenurender no element and accept only open-state and behavior props.Menu2PopupandMenu2SubmenuPopuptake the positioning, portal, transition,elevation,finalFocus, and slot props.rootslot is now the menu surface, which was thepaperslot. The stacking layer, which was therootslot, is nowportal.MuiMenu2andMuiMenu2Submenusupport onlydefaultProps. Popup styles move toMuiMenu2PopupandMuiMenu2SubmenuPopup.MuiMenu2Triggeris a new key that supports onlydefaultProps.c6c5ed3e7bregisters theMuiMenu2*theme types by default and removes theUnstable_Menu2/themeAugmentationentry point.4fb0a872d0removes detached triggers.0a25dc1f9amoves modality to Material UI. Menu2 passesmodal={false}to Base UI and locks page scroll throughModalManager. Touch opens also lock, and a second trigger click closes the menu with reasonoutside-press.282c6b7ca7fixes the Dialog issues from the interop review:backdropslot is now a visual layer only: it renders only when configured and lets clicks through.slots.backdrop={null}removes only the visual layer. Usemodal={false}to let outside clicks through.disableRestoreFocusworkaround only forcloseOnClick={false}, a menu withoutMenu2Trigger, and a customfinalFocus.finalFocusref or function applies only when focus is on the page body or in the menu tree. Base UI applies it in all cases, so it can take focus from a Dialog field.positionMethod="fixed"on every popup level for acontainerinside a Dialog. Plain Base UI needs the same setting.9cf9c434e9replacesslots.indicatorIconandslotProps.indicatorIconwithiconandcheckedIconprops onMenu2CheckboxItemandMenu2RadioItem, as in Checkbox and Radio. ThemedefaultPropscan set them. The icon keeps theindicatorIconclass andstyleOverrides.indicatorIcon, and defaults to the small size.cc7d36c9c5addsstartAdornment,endAdornment, andinsetto all item parts. They replaceListItemIcon,ListItemText, and a shortcutTypographyin the children:<MenuItem startAdornment={<ContentCut fontSize="small" />} endAdornment="Ctrl+X">Cut</MenuItem>.insetkeeps an empty start column, so a text-only label aligns with the labels of items that have a start adornment. Alignment is opt-in. Each part getsstartAdornment,endAdornment, andinsetclasses and theme keys;MuiMenu2Itemkeys apply to all parts.409a99b4acremovesdense. Menu2 has no dense mode. The popup List setsdense={false}, soslotProps.list, the MuiList theme default, and an outer dense List do not change Menu2.76534146a3removes the code that Menu2 shared with the classic Menu.Menu2ItemBasehas its own copy of the item styles. The classicMenuandMenuItemare the same as on master. The rendered styles do not change.9499cea4b1aligns inset separators and group labels with the item labels. An insetMenu2Separatoruses 52px in every position. An insetMenu2GroupLabeluses 52px, or 36px withdisableGutters.0317ba4900removes the classic child composition styles. Items no longer restyleListItemIcon,ListItemText, or a plainDivider, and they no longer provide aListContext. These children render with their List styles. UsestartAdornment,endAdornment,inset, andMenu2Separator.7a793d8033andee12bae260make the slot prop types strict. Unknown keys in the object form are type errors.data-*keys need theDataAttributesOverridesaugmentation, as on the other components.236247c044passes the Base UI state as is to the itemrenderfunctions, as the groups, labels, and separators already do.divider,disableGutters, andinsetstay inownerState. Each part exports aMenu2*Statealias for its render state.fcb588ec25addsrendertoMenu2PopupandMenu2SubmenuPopupfor the menu surface. It keeps the Paper, theme, andsxstyles, andslots.roottakes precedence.slotProps.rootno longer acceptscomponent.12a3e08ce8replacescomponentwithrenderonslotProps.listand onslotProps.indicatorof the checkbox, radio, and submenu trigger items.renderkeeps the slot styles, andslots.<slot>takes precedence. A render function gets the Base UI state of its part.7a75b571e8addsrendertoslotProps.portal,slotProps.positioner, andslotProps.backdropwith the same rule. No part or slot takescomponent.e62520a035types theslotPropsand theme callbacks as their runtime value. They receive the props and the live Base UI state, such ashighlighted. Popup callbacks receive only the props.MuiMenu2Itemalso styles the link, checkbox, radio, and submenu trigger items, so itsdisabledandopenfields are optional.31bea1fab3reads thearia-labelof arenderelement onMenu2PopupandMenu2SubmenuPopup, and theidof aslotProps.portal.renderelement, as Base UI does. Before, the trigger stayed the menu name, andaria-ownspointed to a missing ID.Menu2GroupLabelalso registers theidof itsrenderelement, so the group keeps its name.49aefe75dbalso reads the elementaria-labelwhen thearia-labelprop isundefined.fa98657248keeps the focus thatonOpenChangemoves out of the menu on an item press, as Base UI does. Before, Menu2 moved it to the trigger. The Dialog handoff does not change.e571095599resolves theMuiDividervariant and theMuiListSubheaderinset inMenu2SeparatorandMenu2GroupLabel. An inset from these theme defaults now lines up with the Menu2 items, and the owner state shows the resolved values.4a2609702estates that a Menu v2 menu takes only Menu v2 parts. A classicMenuItemthrows insideMenuPopup, also throughrender. Other classic components render, but Base UI does not register them as items, so arrow keys and typeahead skip them. Other components compose throughrenderon a part. The upgrade guide, the Menu v2 page, and the RFC state the rule, and the customized demo usesstartAdornment.4a3b07912dstates that on React 17, aMenu2TriggerwithopenOnHoverneeds a uniqueidfrom the first render. Anidthat an effect sets later, such as one fromunstable_useId, does not work. The Menu v2 page also says that a classicMenuItemthrows throughrender. The RFC bundle table adds a classic Menu +unstable_enhanceDensitycase (+234 B gzip) and uses the merge base9769f52fee.318ec33a9afixes the React 17 runs. TheAccountMenu2andPositionedMenu2regression demos now need React 18 forReact.useId, and the e2e Account menu uses a static triggerid. The commit removes the e2e DocsLayout tests, because Stack now uses CSS gap, so the fixed focus guards cannot move the trigger. Upgrade step 7 now says to copy the theme keys, and to keepMuiMenuandMuiMenuItemfor Select, TablePagination, and the classic Menu. The RFC adds the theme types as open question 3.Scope
@mui/material/Unstable_Menu2*entry points for 14 components. The classic Menu API does not change.Menu2controls behavior and renders no element.Menu2Triggermerges behavior into the element supplied throughrender.Menu2Popupowns the menu surface, positioning, portal, and transition. Submenus use the same three parts.Menu2Submenurenders no element, andMenu2SubmenuPopupowns the submenu surface. UnlikeMenu2Trigger,Menu2SubmenuTriggerrenders its own menu item, and its children are the item content.dense, and the popup list ignores it.Menu,MenuList, orMenuItem.MuiMenu2PopupandMuiMenu2SubmenuPopup; Menu2 item theme keys remain unchanged. Popup refs,sx, and HTML props target the menu surface. The renderlessMenu2andMenu2Submenusupport behavioraldefaultProps, but no slots or DOM styling. Style the element supplied toMenu2Triggerdirectly.theme.motion.reducedMotion. Other compatible Material transitions and CSS animations remain available.MuiMenu2*entries; no augmentation import is needed.@mui/materialadds@base-ui/react^1.9.0as a direct dependency. Version 1.9.0 includes the menu tree fix and the retained-popup transition fix. No local Base UI patch is included.Changes outside Menu2
These changes affect existing components. Please review them separately.
ModalManageradds an internallockScroll(container)method, anduseModalexports its shared instance for Menu2. A Menu2 and a Modal on one page share one scroll lock, so Base UI and Material UI no longer write the same styles. With no Menu2 open,ModalManagerruns the master code. The public@mui/material/Modalexports do not change.RadioButtonIconmerges aclassNameprop into its root, soMenu2RadioItemcan add theindicatorIconclass.Radiodoes not passclassName, so its output does not change.enhanceHighContrastadds forced-colors overrides for theMuiMenu2*items, including the end adornment.unstable_enhanceDensityadds rules for the Menu2 items and indicators, as the note on #48749 asks, and for the group labels and inset separators. At every density, the Menu2 items match the classic MenuItem height and text start.vitest.shared.mtsinlines@base-ui/reactand@base-ui/utilsin the jsdom tests on React 17. Their ESM files importreact/jsx-runtimewithout an extension, and Node cannot resolve that import for React 17.@mui/material/stylesexportsComponentsOwnerStateList. Theme variants and style overrides readownerStatefrom it. It extendsComponentsPropsList. The Menu2 item, radio group, and separator keys also include the resolved owner state, such ashighlighted.@mui/materialimports from the PigmentContainer, PigmentGrid, and PigmentStack API pages. PigmentContainer also lists itsMuiContainerclasses.typescript-to-proptypespreservesnullin React element-type unions.Menu2Itemrow, so its regression screenshot changes.focus()in the browser test setup now reads the focus options before it calls the native method without arguments. Base UI checkspreventScrollsupport through these options, and without the read it does not return focus after an outside press.Before release
menus.a11y.json. In the non-modal fixture, axe reports anaria-hidden-focusfailure for the Base UI focus guards. The open and nested fixtures report this rule as incomplete. Since axe-core 4.14.1,aria-valid-attr-valuepasses in all three fixtures. The fixtures skip assertions only foraria-hidden-focus.containeronMenu2Popup. The others are Material UI integration gaps and API limits, for example:ModalManagercan hide a retained popup inside a kept-mounted Dialog. With the default portal container, leavekeepMounteddisabled onMenu2Popupinside a kept-mounted Dialog. Menu2 also has the known limits of the Modal scroll lock, the same as Dialog: no lock whenhtmlscrolls the viewport, and an old body overflow value restored when other code changes it while the menu is open. A separate change can fix both for every Modal. A Dialog withdisableScrollLockalso blocks the lock of a Menu2 above it, or keeps the lock of a Menu2 below it until the Dialog closes. [modal] Fix the scroll lock of stacked modals with disableScrollLock #49915 fixes this for every Modal. Acontainerinside a positioned element that clips its overflow, such as the Dialog paper, clips the menu. SetpositionMethod="fixed"onMenu2Popupand on eachMenu2SubmenuPopup.v9.xafter the merge. The upgrade guide and the Menu v2 page name v9.7 as the first release. If v9.7 does not include the cherry-pick, change the version on both pages.nightlyCircleCI workflow on the PR. It runs React 17, React 18, and React next, which PR CI does not run. A local run of the Menu2 tests on React 17 and 18 passes.Open questions for the team
The RFC open questions list the gains, costs, and alternative for each question:
renderstate shape:renderreceives the unchanged Base UI state, and the Material props are only inownerState. ShouldrenderreceiveownerStateinstead?DividerandPaper, so the theme keys of these components also reach Menu2. Should the Menu2 parts stay open to these keys, or separate from them?MuiMenu2*entries, so each TypeScript program that imports Material UI loads about 150 more declaration files. Should we keep this, or restore the opt-inUnstable_Menu2/themeAugmentationimport?Known limitations and follow-ups
The RFC known issues list the user-facing limits. These items are for reviewers:
data-rootowneridattribute, setsdata-base-ui-inert, and has three focus workarounds that depend on Base UI 1.9.0 timing. At03543cfbd2, 6 Menu2 tests failed on the build of [popups] Keep closing popups out of the a11y tree and focus order base-ui#5537. Run the Menu2 tests on each Base UI upgrade.Menu.GroupLabelregisters its generated ID, not the ID of arenderelement, so plain Base UI leaves the group unnamed.Menu2GroupLabelworks around it for the element form. [accordion][combobox][dialog][field][fieldset][menu][meter][popover][progress][select][slider][tabs][toast] Register the rendered id of labels, titles, and descriptions base-ui#6358 fixes it in Base UI. Remove the workaround after the upgrade to the next Base UI release.Menu2TriggerwithopenOnHoverand noiddoes not open on hover (RFC known issue). [menu][popover] Keep the trigger mounted on React 17 base-ui#6359 (draft) fixes it in Base UI. The docs tell users to set anidfrom the first render, and the tests set a static triggerid.slotProps.portal.renderfunction that sets its ownidleavesaria-ownson a missing ID. Plain Base UI reads the ID from the returned element. UseslotProps.portal.idor a render element.highlightedfor the five item parts androotforMenu2Triggeras rule names. The theme types reject these keys, and the runtime ignores them. [docs-infra] Hide rule names that are not styleOverrides keys #49778 hides these rule names.slotPropscallback returns, so unknown keys andcomponentpass. This is a TypeScript limit, also withoutWithDataAttributes, so classic components have the same gap. Menu2 also has noMenu2*SlotPropsOverridesinterfaces.Menu2Submenudoes not warn in development when it has noMenu2SubmenuTrigger. A plainMenu2Itemin its place does not open the submenu. Base UI does not warn either.List, andslotProps.listtakesListPropswithoutdense. A follow-up can replaceList, and that change also changes theslotProps.listAPI.Menu, and their move to Menu2 is a separate decision. Upgrade step 7 tells apps to keep theMuiMenuandMuiMenuItemtheme keys for these components.Experiments