v0.136.0
Minor Changes
-
#1150
ad7624bbThanks @tenphi! - Menu / Tray: gate mobile tray rendering behind amobileTypeopt-in and letTrayacceptshouldCloseOnInteractOutside.Traynow accepts ashouldCloseOnInteractOutside?: (element: Element) => booleanprop and forwards it to React Aria'suseOverlay. Without it, the underlyinguseOverlayunconditionally callsstopPropagation/preventDefaulton outside pointer/click events whenever the tray is the topmost overlay, which can swallow clicks on sibling triggers (e.g. a secondMenuTrigger). The new prop matches the existing API onPopover.MenuTriggerno longer auto-swaps itsPopoverfor aTrayon mobile screens. The previous behaviour relied onuseIsMobileDevice()(which returnstruein jsdom-style environments wherewindow.screen.widthis0), so the mobile branch could activate unintentionally. Opt in explicitly withmobileType="tray"(defaults to'popover'), mirroring the establishedmobileTypeAPI onDialogTrigger.MenuTriggernow passes the sameshouldCloseOnInteractOutsidecallback to both thePopoverandTraybranches, so sibling-trigger clicks aren't swallowed in either overlay variant.
This is a behavioural change for apps that intentionally relied on the implicit mobile tray. To restore the previous look, pass
mobileType="tray"to the relevantMenuTriggers.
Patch Changes
-
#1150
ad7624bbThanks @tenphi! - Popover dismiss for plain Button / ItemButton: a single click on aButtonorItemButtonrendered outside an open popover now closes the popover AND fires the button'sonPressin the same click. Previously the first click was always swallowed byuseOverlay'sshouldCloseOnInteractOutside(whichstopPropagations outside clicks), so users had to click twice.ButtonandItemButtonnow mark their root withdata-popover-dismiss.MenuTrigger,Select,ComboBox,FilterPicker, andPickerrecognize[data-popover-dismiss]outside-click targets and schedule their close viasetTimeout(0)so the close lands AFTER the click event finishes (i.e. after the button'sonPressruns). The predicate returnsfalseso the click is not stopped.
Button/ItemButtonused as a popover trigger (wrapped byPressResponder/MenuTrigger) keep their existing trigger behaviour — the trigger branch matches first, the dismiss branch is never reached.