Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
window.scrollTo not working as expected

For some reason, calling window.scrollTo from the frontend of a Tecton extension doesn't seem to be working.

I'm doing something like

window.scrollTo({ top: 50, behavior: 'smooth' });

Here's a codesandbox of what's expected. However, doing something similar inside of a Tecton extension does nothing.

Any ideas?

Posted 3 years ago
Votes Newest

Answers 2


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().

Posted 3 years ago

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

0

Hey Kristopher, thanks for the info! We're wanting to scroll to something from within the iframe.

— David Maksimov   3 years ago
0

David, sorry for the delay as I did not receive a notification on your response. Thank you for answering my question. As we discuss and prepare adding this enhancement, I definitely want to make sure we allow you do exactly what you need.

— Kristopher Van Houten   3 years ago
109 Views
2 Answers
3 years ago
3 years ago