When calling scrollTo inside an iframe, it scrolls the iframe and not the parent window. So if the iframe's height is large enough to fit all the content and it has no scroll, calling scrollTo won't do anything.
Examples:
Scroll inside iframe: https://codesandbox.io/embed/practical-northcutt-6q7d29?fontsize=14&hidenavigation=1&theme=dark
No scroll inside iframe: https://codesandbox.io/s/exciting-volhard-xkmug2?file=/index.html
So question now is, does Tecton have a way for us to call scrollTo on the parent window? I see that Tecton has a scrollToTop method but wondering if there's something like scrollTo().
Hey David,
Your findings are correct. We have some code that runs in the background of your module, inside that iframe that keeps the height of the iframe in sync with the height of its content. This is in place so that the platform is in charge of scrolling instead of the iframe. As a result, calling window.scrollTo will not do anything.
We do have the scrollToTop capability, and have plans to deliver a scrollTo functionality, but it has not been fully slotted yet. Are you trying to scroll to another section of your module, within your iframe, or to a place outside the iframe?
Thanks,
Kris