Turning off auto scroll to top of page Dawn 2.0

Topic summary

A user initially sought a solution to prevent their Shopify store from automatically scrolling to the top when customers use the back button, wanting them to return to their previous scroll position.

Resolution:

  • The original poster first resolved their issue by adding a back button to their site.
  • Another user provided a more technical solution for the Dawn 2.0 theme.

Technical Fix (confirmed working):

  • Navigate to Online Store → Themes → Edit Code
  • Open the theme.liquid file
  • Remove the <main id="MainContent"...> opening tag and its corresponding </main> closing tag
  • Save changes

Explanation: These code lines prevent content from fully loading after the initial page load, which causes the browser to lose the Y-scroll position when navigating back.

The solution works on both desktop and mobile devices and was successfully tested by another community member.

Summarized with AI on October 30. AI used: claude-sonnet-4-5-20250929.

Hi,

Is it possible to allow my customers to return to the same area of the page they were at previously? Currently when a customer clicks on the back button, it returns them to the previous page but they have to start at the very top. Hope that makes sense. Thanks for your help.

Never mind, didn’t realize that I needed a back button. I added one and all is well.

1 Like

Hi Sunnydjl,

  1. go to Online Store —> Themes

  2. Click on Action and duplicate your theme for an Backup.

  3. Click on Action again, Edit Code

  4. Open your theme.liquid file.

  5. Find the following code line (3 lines in total, you just need the middle one. ) Remove the line:

Also remove the third line

  1. Press Save

  2. Reload your page and try it.

Works also on mobil.

hope that helps.

Reason is, that with this code line some content will not be loaded completely after the page load is done. So if you go to a new page there is no Y-Scroll Position to remember in case if you press the back button.

Have a great day, all my best,

Stefan

1 Like

I had the same issue and removing this specific line of code you mentioned worked! Thank you so much!