Close Mobile Menu Overlay on clicking an anchor link
Close Mobile Menu Overlay on clicking an anchor link
At a glance
The community member is using the Radix Mobile Menu component and is facing an issue where the sheet overlay does not close when tapping on an anchor link inside the nav menu. The overlay remains visible, hiding the content behind it. The community member is looking for the simplest way to achieve this functionality, where the overlay closes when an anchor link on the same page is clicked.
In the comments, another community member provides a workaround link that may help solve the issue. Another community member confirms that the workaround works perfectly.
I'm using Radix Mobile Menu component. On Mobile, when tapping on the hamburger menu icon, the sheet overlay appears. I'd like to achieve that this overlay closes when tapping on an anchor link inside the nav menu contained in this sheet. As of now the browser does navigate to that particular anchor on clicking such links, but the sheet overlay is still visible and hides the content behind it.
Of course this only applies to anchor link on the same page, as link to new pages do close the overlay since a new page is loaded.