Shopify themes, liquid, logos, and UX
Hi,
Could someone give me instructions on how to handle section and block JavaScript events on Dawn theme?
For example, Shopify emits JavaScript events such as shopify:section:select, shopify:block:select, etc. I want to know how to handle these events on specific elements such as MenuDrawer and HeaderDrawer in performace-optimized ways.
Thanks.
Hey there @tobychen ,
In order to do something when a section is re rendered or a block selected/deselected, you would use those events: https://shopify.dev/themes/architecture/sections/integrate-sections-with-the-theme-editor#section-an...
So for example you could set an event listener on the document to listen for the event: `shopify:section:load`. And in your function to deal with the event, you can log the `event.detail` and it will give you the information mentioned in the table from the link I shared above. So for shopify:section:load it will give you the section ID of the section that is being re rendered.
Does that help ?
To learn more visit the Shopify Help Center or the Community Blog.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025