Skip to content

Overlay not closed when clicking another MenuTrigger #1155

@madmanwithabike

Description

@madmanwithabike

This is possibly related to #850, but using the @react-aria hooks only and is repeatable on every click, #850 seems to be fast click only and not reproducible at all in some cases.

🐛 Bug Report

Clicking between two (or more) buttons with useMenuTrigger and useOverlay, does not close the currently open menu.

🤔 Expected Behavior

Open menu should close and new menu should open.

😯 Current Behavior

This seems to only happen with useMenuTrigger, clicking from an open menu to a button using useButton closes the menu as expected.

Screenshot:

image

When clicking away repeatedly, the overlays are then closed one at a time in reverse order.

💁 Possible Solution

Possibly related to #850.

💻 Code Sample

Can be reproduced using the useMenuTrigger sample code: https://react-spectrum.adobe.com/react-aria/useMenuTrigger.html#example but duplicating the MenuButton:

<MenuButton label="Actions">
  <Item key="copy">Copy</Item>
  <Item key="copy">Copy</Item>
  <Item key="copy">Copy</Item>
</MenuButton>
<MenuButton label="Actions">
  <Item key="copy">Copy</Item>
  <Item key="copy">Copy</Item>
  <Item key="copy">Copy</Item>
</MenuButton>

🌍 Your Environment

Software Version(s)
@react-aria/button 3.2.2
@react-aria/menu 3.1.2
@react-aria/overlays 3.4.0
Browser Chrome + Firefox
Operating System Ubuntu 18.04 + Windows 10

Thanks!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions