Skip to content

Commit

Permalink
Hide menus when they lose focus
Browse files Browse the repository at this point in the history
  • Loading branch information
gnapse committed Mar 7, 2024
1 parent cca366b commit f9bb117
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ const MenuList = polymorphicComponent<'div', MenuListProps>(function MenuList(
className={classNames('reactist_menulist', exceptionallySetClassName)}
getAnchorRect={getAnchorRect ?? undefined}
modal={modal}
onBlur={(event) => {
if (!event.relatedTarget) return
if (event.currentTarget.contains(event.relatedTarget)) return
if (event.relatedTarget?.closest('[role^="menu"]')) return
menuStore.hide()
}}
/>
</Portal>
) : null
Expand Down

0 comments on commit f9bb117

Please sign in to comment.