Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu clickOutside triggering on false positives #899

Closed
justinsmid opened this issue Feb 25, 2022 · 4 comments
Closed

Menu clickOutside triggering on false positives #899

justinsmid opened this issue Feb 25, 2022 · 4 comments

Comments

@justinsmid
Copy link
Contributor

What package has an issue

@mantine/core

Describe the bug

A semi-recent change to <Menu /> (fee7d0e) changed the default clickOutsideEvents used by Menu. This has started causing false-positive triggers in our application. i.e.: our menus are closing from clicks that shouldn't close them.

The reason this happens is that we have an element in our menu that disappears when clicked. With the recent change mentioned above, your code to check whether the click was inside the menu now occurs after our code that removes the element triggers, whereas before the change your code triggered before our code. This leads to the event.target that your code uses being null (or undefined, I forgot) by the time your code runs, at which point it thinks the element is not in the menu.

To reproduce: go to the provided codesandbox, open the menu, type something into the searchbar and click Clear in the searchbar.

In which browser did the problem occur

I've confirmed it occurs on Chrome and Firefox, but I assume it occurs on all (major) browsers.

If possible, please include a link to a codesandbox with the reproduced problem

https://codesandbox.io/s/mantine-menu-close-false-positive-2sc307?file=/src/App.js

Do you know how to fix the issue

No

Are you willing to participate in fixing this issue and create a pull request with the fix

No

Possible fix

No response

@justinsmid justinsmid added the bug label Feb 25, 2022
@rtivital
Copy link
Member

I recommend switching to Popover as in your case component will throw error when arrows are used. The behavior you are describing is odd and should not be related to commit changes, but I'll have a look.

@rtivital
Copy link
Member

rtivital commented Mar 1, 2022

Fixed in 3.6.12

@rtivital rtivital closed this as completed Mar 1, 2022
@rtivital
Copy link
Member

rtivital commented Mar 1, 2022

Wrong issue

@rtivital rtivital reopened this Mar 1, 2022
@rtivital
Copy link
Member

rtivital commented Mar 2, 2022

Fixed in 3.6.13, your example works fine now

@rtivital rtivital closed this as completed Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants