base-ui icon indicating copy to clipboard operation
base-ui copied to clipboard

[menu] Fix (click, drag outside, release) not closing the menu

Open michaldudak opened this issue 5 months ago • 7 comments

#2094 broke cancelling opening of the menu by dragging outside.

Here I'm setting a root id on every menu popup and when a mouse pointer is released over an element I check if this element belongs to the root.

michaldudak avatar Jun 24 '25 13:06 michaldudak

Open in StackBlitz

npm i https://pkg.pr.new/@base-ui-components/react@2156

commit: 4d0f66d

pkg-pr-new[bot] avatar Jun 24 '25 13:06 pkg-pr-new[bot]

Bundle size report

Bundle Parsed Size Gzip Size
@base-ui-components/react 🔺+312B(+0.10%) 🔺+133B(+0.14%)

Details of bundle changes

Generated by :no_entry_sign: dangerJS against 4d0f66d965ff831072f0ea3d35e8fea8cfd707d0

mui-bot avatar Jun 24 '25 13:06 mui-bot

Deploy Preview for base-ui ready!

Name Link
Latest commit 4d0f66d965ff831072f0ea3d35e8fea8cfd707d0
Latest deploy log https://app.netlify.com/projects/base-ui/deploys/686387eb5cd45b00085bbcf5
Deploy Preview https://deploy-preview-2156--base-ui.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Jun 24 '25 13:06 netlify[bot]

This seems to break the exit animation when you mousedown -> mousemove into a submenu -> mouseup

atomiks avatar Jun 25 '25 12:06 atomiks

I can't reproduce it. Does it still happen to you after the last merge commit?

https://github.com/user-attachments/assets/e6d91f58-a390-45a3-854d-060a2a79a7c6

michaldudak avatar Jun 25 '25 13:06 michaldudak

It happens with Menubar. It also happens when moving to a different menu, not just a submenu

atomiks avatar Jun 25 '25 13:06 atomiks

Alright, fixed.

michaldudak avatar Jun 25 '25 13:06 michaldudak

I was able to get into this state where dragging to a new menu trigger doesn't open it:

https://github.com/user-attachments/assets/2603f577-775c-4c21-8e9c-28ba4c0fa859

atomiks avatar Jul 01 '25 07:07 atomiks

This also exists in master, looks like a regression. It also happens if you try to mouseenter in general to the next trigger, regardless of the drag

atomiks avatar Jul 01 '25 07:07 atomiks