Prevent page going back to top after clicking custom component modal

Builder content link

Builder public api key

What are you trying to accomplish
I’m trying to prevent the page refreshing and going back to the top after clicking one of our custom button components. These custom buttons open a custom model that our frontend engineers have built. After I close the button, I don’t want the page to load at the top, but at the same spot on the page where I clicked the button. I’ve tried using event.preventdefault() javascript code as well. Please let me know if you have any ideas.

Screenshots or video link
Screenshots of your issue, or even better a link to a video of what is happening or what you are trying to accomplish. We love using loom for that sort of thing

Code stack you are integrating Builder with
angular, chrome

Hi there,

Thanks for reaching out!

If there is a reload on the page, unless you have attached an anchor link to an element, and the id matches in the url.

Alternatively, you could explore more JS solutions with your developers that can save the scroll position in local storage, and then call it when the page reloads. I’ve attached a few Stack Overflow links that will help get you and your engineers started:

1 Like