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] Menu click away is broken if transitionDuration
CSS property is used
#9
Comments
Hello, I reproduced your issue on my local machine by following all the steps. However, for me it seems to be working, the menu collapses when I click away from it no matter how I style it. 2024-02-09.08-25-57.mp4 |
transitionDuration
CSS property is usedtransitionDuration
CSS property is used
@EyaOuenniche Your video doesn't appear to show the second menu animating at all. For me, the issue happens when I add the If you did that, it may also require there to be an animatable property. In my demo, both menus change from |
I'm sorry for the confusion, I reproduced again your issue, and I added the transitionDuration property. I think I'm having a problem in the animation it's not working correctly, but nonetheless I found the same problem I think there is an area where you click on it, it will close, it's the area where the items are displayed. Also, I think if you repeat the process of opening and closing the menu several times, you will notice that at some point it will work, and the menu will collapse when you click away from it. I have a suggestion, maybe the issue is due to the way the Dropdown and Menu components from @mui/base handle closing, the Dropdown or Menu might be trying to close before the transition is complete, which could be causing the menu to stay open. |
transitionDuration
CSS property is usedtransitionDuration
CSS property is used
Are there any updates on this issue? It is still happening with the latest version, 5.0.0-beta.40. |
The root issue here is that the menu item is not focused after a menu opens; therefore, its blur handler (which closes the menu) does not fire when you click outside. The new transition API should account for this, notifying the element when the transition finishes, so it can be focused (cc @atomiks). We will take this into consideration when redesigning the Menu's API (which should happen around June). |
Steps to reproduce
Link to live example: https://codesandbox.io/p/sandbox/compassionate-burnell-mns7ll
issue.mp4
Steps:
Current behavior
If I use the
transitionDuration
CSS property when styling the menu, it will not collapse when I click away from it.Expected behavior
The menu should always collapse, no matter how I style it.
Context
I want the menu to collapse when I click away from it, no matter how I style it.
Your environment
npx @mui/envinfo
I used Chrome when testing this issue.
Search keywords: menu click away broken css
The text was updated successfully, but these errors were encountered: