Simple menu doesn't close when clicked outside of the menu on mobile
See original GitHub issueWhat MDC-Web Version are you using?
"@material/menu": "^0.2.6",
What browser(s) is this bug affecting?
Mobile Chrome and Mobile Safari on iOS
What OS are you using?
iOS 10.3.1
What are the steps to reproduce the bug?
- Open this demo page on mobile Safari
- click
REVEAL MENU
to open it - Tap anywhere outside of the menu. See that menu is not closed.
What is the expected behavior?
Menu should be closed when tapped outside. That is the behavior on Google Chrome on desktop.
What is the actual behavior?
When clicked outside of a menu, it is not closed, nothing happens.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
Top Results From Across the Web
jquery - Mobile Menu - Click outside menu to close menu
I have that button in my mobile website; the problem is, that I need to add a method that when the user clicks...
Read more >Close mobile menu when click/tap outside - GeneratePress
Hi,. My mobile menu doesn't close when clicked/tapped outside of it. I would like it to do so. If I have a sub-menu...
Read more >How To Close The Divi Mobile Menu By Clicking ... - YouTube
In this tutorial I will show you how to close the Divi mobile menu by clicking or touching outside the menu dropdown areaBlog...
Read more >How To Close The Divi Mobile Menu By ... - Pee-Aye Creative
But not so, it does not do that in Divi. So we created a jQuery snippet to do just that, and in this...
Read more >Close Div or Menu On Click Outside w/ Javascript - Tech Junkie
In this case, if the menu hasn't been opened yet, there's no reason to listen for a click outside of the menu. Add...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Found out this is because iOS doesn’t emit a click event if the element you are tapping on isn’t considered “clickable”.
Workaround is setting all elements as “clickable”
Given that you’re listening for a click on the body to close a dropdown, it’s enough to specify
cursor: pointer
on the body alone