magic-akari / seamless-scroll-polyfill

Scroll Behavior polyfill
https://www.npmjs.com/package/seamless-scroll-polyfill
MIT License
159 stars 11 forks source link

Parameterless call of scrollIntoView not working as intended #141

Closed anwerso closed 1 year ago

anwerso commented 1 year ago

scrollIntoView() without parameters not working right when you use scroll-margin/scroll-snap-margin to adjust scrolling position. The workaround is to add an empty object. The culprit is the check to use original prototype when there are no params. As a solution we can always convert params to a new format and use polyfilled version.

magic-akari commented 1 year ago

The primary purpose of this polyfill is to patch the 'smooth' function. The detection of 'scroll-snap-margin' is necessary for compliance with the specifications.

Additionally, it assumes the other features, such as 'scroll-snap-margin', to be functioning as intended.\ Therefore, when the parameters are not set to 'smooth', the polyfill will directly call the native method.