Shopify themes, liquid, logos, and UX
Hey guys,
The Drawer Menu Won't Close After Clicking Anchor Links. It makes them kind of useless. Any idea how to solve this problem? I'm using the Dawn Theme.
BentleyRolling.com
Thank you in advance!
Solved! Go to the solution
This is an accepted solution.
In your "Footer", add a "Custom liquid" section and paste this code:
<script>
document.querySelector('header-drawer').addEventListener('click', e => {
if (e.target.tagName !== 'A') return;
let url = new URL (e.target.href);
if (url.pathname != location.pathname) return;
if (!document.querySelector(url.hash)) return;
let closeButton = e.currentTarget.querySelector('summary');
if (closeButton) closeButton.dispatchEvent( new Event('click'));
});
</script>
Hello @Rolling,
Could you grant me access to your store? I'd be glad to assist you.
Thanks!
This is an accepted solution.
In your "Footer", add a "Custom liquid" section and paste this code:
<script>
document.querySelector('header-drawer').addEventListener('click', e => {
if (e.target.tagName !== 'A') return;
let url = new URL (e.target.href);
if (url.pathname != location.pathname) return;
if (!document.querySelector(url.hash)) return;
let closeButton = e.currentTarget.querySelector('summary');
if (closeButton) closeButton.dispatchEvent( new Event('click'));
});
</script>
This is the best solution. Thank you for your help. Super easy without editing code. Anyone looking for the real solution to this problem, this is it!
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025