Skip to content

v0.136.0

Choose a tag to compare

@github-actions github-actions released this 11 May 10:29
7fdcfad

Minor Changes

  • #1150 ad7624bb Thanks @tenphi! - Menu / Tray: gate mobile tray rendering behind a mobileType opt-in and let Tray accept shouldCloseOnInteractOutside.

    • Tray now accepts a shouldCloseOnInteractOutside?: (element: Element) => boolean prop and forwards it to React Aria's useOverlay. Without it, the underlying useOverlay unconditionally calls stopPropagation / preventDefault on outside pointer/click events whenever the tray is the topmost overlay, which can swallow clicks on sibling triggers (e.g. a second MenuTrigger). The new prop matches the existing API on Popover.
    • MenuTrigger no longer auto-swaps its Popover for a Tray on mobile screens. The previous behaviour relied on useIsMobileDevice() (which returns true in jsdom-style environments where window.screen.width is 0), so the mobile branch could activate unintentionally. Opt in explicitly with mobileType="tray" (defaults to 'popover'), mirroring the established mobileType API on DialogTrigger.
    • MenuTrigger now passes the same shouldCloseOnInteractOutside callback to both the Popover and Tray branches, 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 relevant MenuTriggers.

Patch Changes

  • #1150 ad7624bb Thanks @tenphi! - Popover dismiss for plain Button / ItemButton: a single click on a Button or ItemButton rendered outside an open popover now closes the popover AND fires the button's onPress in the same click. Previously the first click was always swallowed by useOverlay's shouldCloseOnInteractOutside (which stopPropagations outside clicks), so users had to click twice.

    • Button and ItemButton now mark their root with data-popover-dismiss.
    • MenuTrigger, Select, ComboBox, FilterPicker, and Picker recognize [data-popover-dismiss] outside-click targets and schedule their close via setTimeout(0) so the close lands AFTER the click event finishes (i.e. after the button's onPress runs). The predicate returns false so the click is not stopped.

    Button/ItemButton used as a popover trigger (wrapped by PressResponder/MenuTrigger) keep their existing trigger behaviour — the trigger branch matches first, the dismiss branch is never reached.