scroll-into-view / scroll-into-view-if-needed

Element.scrollIntoView ponyfills for things like "if-needed" and "smooth"

Home Page:https://scroll-into-view.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for upcoming promise behavior

stipsan opened this issue · comments

Smooth scrolling will return promises in the future: w3c/csswg-drafts#1562

Suggested implementation here is:
If the browser is returning a promise, pass it through and let the browser decide how it's resolved.
If the browser isn't returning a promise, but the behavior is set to "smooth", use Promise.reject as there is no way of knowing when scrolling is complete anyway so userland code needs to handle both cases.