Embedded App - Modal always causes jump to top of page

Hi All,

Working on an embedded app and noticed that whenever a modal is triggered on the page, the underlying page will always jump to top position.

So for example, I am scrolling down a longer page and want to view some details within a modal. When I click the button, the modal is shown and I then close it. Instead of being where I was in the longer page, I am now back at the top.

I'd love to use the built in SDK modals, but this behaviour kind of ruins it for our use case. Any ideas how to cancel this "jump to top" behaviour?

Many thanks,
Bjørn

Bjorn Forsberg | FORSBERG+two | Award-winning Shopify Apps since 2011
0 Likes
Shopify Expert
9780 86 1531

Sounds like the script that fires the modal box is not returning false (or preventing default) so it's adding a hash element to the url, hence the jump.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
1 Like

Thanks Jason, that did the trick! Sometimes it's the simple things that make all the diffrerence ;)

Bjorn Forsberg | FORSBERG+two | Award-winning Shopify Apps since 2011
0 Likes