-
Notifications
You must be signed in to change notification settings - Fork 161
fix(grid): restore trailing scroll emission so top rows aren't lost after fast scroll #17455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2161,6 +2161,38 @@ describe('IgxGrid Component Tests #grid', () => { | |
|
|
||
| expect(grid.headerContainer.state.startIndex).toBeGreaterThan(0); | ||
| }); | ||
|
|
||
| it('should settle at the top row when a fast momentum scroll ends at scrollTop 0 (throttle trailing edge)', async () => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason this test is placed under
Comment on lines
+2164
to
+2165
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In my manual comparison against Because this test emits directly through |
||
| const fix = TestBed.createComponent(ZonelessTallGridComponent); | ||
| fix.detectChanges(); | ||
| await fix.whenStable(); | ||
| const grid = fix.componentInstance.grid; | ||
| const virtDir = grid.verticalScrollContainer; | ||
| const scrollEl = virtDir.getScroll(); | ||
| const maxScroll = scrollEl.scrollHeight - scrollEl.clientHeight; | ||
|
Zneeky marked this conversation as resolved.
|
||
|
|
||
| // Move away from the top so the first rows are virtualized out of view. | ||
| grid.scrollNotify.next({ target: { scrollTop: maxScroll } }); | ||
| await wait(50); | ||
| await fix.whenStable(); | ||
|
Zneeky marked this conversation as resolved.
|
||
| expect(virtDir.state.startIndex).toBeGreaterThan(0); | ||
|
|
||
| // Simulate a fast momentum/inertia scroll back to the top: an intermediate | ||
| // position lands on the throttle's leading edge and the scrollTop = 0 settle | ||
| // arrives within the same throttle window, so it can only be delivered on the | ||
| // trailing edge. Feeding scrollNotify directly (instead of setting scrollTop) | ||
| // avoids the browser's async native scroll events - which all read the final | ||
| // scrollTop of 0 - from masking a dropped-trailing regression. | ||
| grid.scrollNotify.next({ target: { scrollTop: Math.round(maxScroll / 2) } }); | ||
| grid.scrollNotify.next({ target: { scrollTop: 0 } }); | ||
| await wait(50); | ||
| await fix.whenStable(); | ||
|
|
||
| // Without the trailing edge the settle event is dropped and the grid stays | ||
| // frozen at an intermediate startIndex while the scrollbar sits at the top. | ||
| expect(virtDir.state.startIndex).toBe(0); | ||
| expect(grid.gridAPI.get_row_by_index(0)).toBeDefined(); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.