Closed Ryiski closed 1 year ago
The issue is coming from Popover Component
It works as intended – when you click outside the menu, it loses focus. Menu/Popover and other similar components can only spy on escape key presses if focus is inside the dropdown (otherwise there will be issues with escape key in nested overlays, for example, Menu inside Modal). closeOnClickOutside
is an accessibility option – if you turn it off, you should expect some accessibility features not to function as intended.
@rtivital ok the closeOnEscape makes sense
As for, when closeOnClickOutside
is true, it should always close the menu when a mouse down or touch event is triggered.
But it only works on the first closeOnClickOutside
event, every other closeOnClickOutside
events work at random times.
I came up with a workaround and it's working as I believe it should have
I added it to the sandbox so you can have a look at it
https://codesandbox.io/s/patient-fog-9uhrk9
PS: correct me if I'm wrong on how the closeOnClickOutside
is expected to work
It is a separate issue, see https://github.com/mantinedev/mantine/issues/2551, will be fixed with next release
What package has an issue
@mantine/core
Describe the bug
The menu feature "close on click outside" works only the first time but then doesn't work as intended
Also when its stuck, closeOnEscape refuses to close
Also, there is a case when 1 - set closeOnClickOutside it false and closeOnEscape true 2 - click outside 3 - hitting ESC won't work
What version of @mantine/hooks page do you have in package.json?
^5.4.1
If possible, please include a link to a codesandbox with the reproduced problem
https://codesandbox.io/s/beautiful-einstein-whij6t?file=/src/App.tsx
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 response
Possible fix
No idea : (