fix(mobile): workspace selector not close on click outside (#8096)

This commit is contained in:
pengx17
2024-09-04 16:57:57 +00:00
parent 0ae5673aaa
commit 989e8830f7

View File

@@ -19,6 +19,7 @@ export const MobileMenu = ({
contentOptions: { contentOptions: {
className, className,
onPointerDownOutside, onPointerDownOutside,
onInteractOutside,
// ignore the following props // ignore the following props
sideOffset: _sideOffset, sideOffset: _sideOffset,
side: _side, side: _side,
@@ -59,12 +60,13 @@ export const MobileMenu = ({
if (!open) { if (!open) {
// a workaround to hack the onPointerDownOutside event // a workaround to hack the onPointerDownOutside event
onPointerDownOutside?.({} as any); onPointerDownOutside?.({} as any);
onInteractOutside?.({} as any);
setSubMenus([]); setSubMenus([]);
} }
setOpen(open); setOpen(open);
rootOptions?.onOpenChange?.(open); rootOptions?.onOpenChange?.(open);
}, },
[onPointerDownOutside, rootOptions] [onInteractOutside, onPointerDownOutside, rootOptions]
); );
const onItemClick = useCallback( const onItemClick = useCallback(