Internal `rangechange` event firing too frequently when scrolling near top of list
graynorton opened this issue · 1 comments
Found in: 0.7.0
Expected Behavior:
The internal rangechange
event should fire with similar frequency regardless of the current scroll position.
Actual behavior:
rangechange
fires much more frequently when scrolled to the top of the list
Repro steps:
1. Open https://tinyurl.com/3aapymvz
2. In Chrome Dev Tools, locate the Virtualizer.js
file in the Sources tab and open it:
3. Within that file, find the line containing case 'rangechange'
and add a logpoint on the next line (just log anything, doesn't matter what):
4. In Dev Tools, switch to the Console
tab.
5. In the playground's Result
pane, scroll down slowly. You'll see lots of logging to the console, more or less with every pixel you scroll.
6. Scroll more quickly down the view, until 'Item 1' or later becomes visible.
7. Clear the console, then resume scrolling slowly down.
=> You'll see that logging happens much less frequently.
The behavior near the top of the list is incorrect; the frequency of rangechange
events is too high.
Notes:
This seems to be due to a bug introduced when adding support for margin-collapsing, in this commit: ca42077
Specifically, we aren't treating margins consistently when calculating the internal physicalMin
and physicalMax
state variables that are used to trigger layout updates.
This bug has already been fixed; just writing it up for review / posterity.
This is an incredibly well written issue and repro. Great easy to follow steps. Thank you!
TIL logpoint
.