fix: scrollIntoView ending earlier than the duration given as an option #35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Details
https://codepen.io/malangfox/pen/MWPLWvV
In the above demo, when the
scrollIntoView
is triggered by pressing the button, the scroll moves for 5000ms, but when item 11 is placed at the far right end and the button is pressed, the time it takes to move to the end of the scroll area is not 5000ms.Fixing this as a bug could lead to a new issue of
scrollIntoView
being slow at the end of the scroll area after updating the version of Conveyer, so I would like to support the existing behavior but add an option to check the minimum/maximum scrollable distance when calculating the distance forscrollBy
inscrollIntoView
so that it always has the same scroll animation time.I'm currently using the
fixedDuration
name as a temporary name, but I'm trying to think of another appropriate name.