nexushoratio / userscripts

Random userscripts for browsers.
GNU General Public License v3.0
2 stars 0 forks source link

`Scroller` may be calling `scrollToCurrentItem` excessively. #132

Open nexushoratio opened 1 year ago

nexushoratio commented 1 year ago

Find a comment with at least two nested replies. Navigate to the second reply. Gently scroll until the current comment is a few pixels above the fold. Navigate to the previous comment.

Even though the previous reply is wholly in view, there will still be vertical movement as the bottom comment is shifted back into view, likely due to scrollMarginBottom.

it seems to happen due to the call to item.scrollIntoView({block: 'nearest', inline: 'nearest'});. But, the thing is, this is being called twice. And it is the first call that resets things. But a log statement just before that scrollIntoView to verify that a single previous comment command results in the function being called twice.

Hypothesis: There is a this.item = this.item reset causing this.