Giving users access to smoothscrollAnchorPolyfill.shouldSmoothscroll() would allow userland implementations for JS scroll APIs to stay in sync with the behavior detected by this polyfill.
Something along the lines of:
const scroll = scrollTo = function (opts = {}) {
if (!opts.behavior && shouldSmoothscroll()) {
opts.behavior = 'smooth'
}
const container = this instanceof Element ? this : window
container.scroll(opts)
}
Renaming the API should be considered too, as well as maybe returning the detected behavior as a string (smooth|auto|initial|inherit|unset) instead of a simple boolean.
Giving users access to
smoothscrollAnchorPolyfill.shouldSmoothscroll()
would allow userland implementations for JS scroll APIs to stay in sync with the behavior detected by this polyfill.Something along the lines of:
Renaming the API should be considered too, as well as maybe returning the detected behavior as a string (
smooth|auto|initial|inherit|unset
) instead of a simple boolean.