Skip to content

fix: adjust virtualizer indexes when scrolling at the end #9142

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ugur-vaadin
Copy link
Contributor

@ugur-vaadin ugur-vaadin commented May 14, 2025

Description

The indexes in the virtualizer are not properly updated when

  • The virtualizer scroll container is full width
  • The virtualizer scroll target is fixed width
  • The virtualizer is at the bottom
  • The scroll target is resized to be larger

This case is not properly handled in the iron list core or the adapter. The result is the items not being properly rendered and some loops occurring based on resize timing.

This PR adapts the index adjustment on large jump logic in the iron list core _scrollHandler to the adapter override so that the rows are rendered correctly.

Before fix:

withoutFix.mov

After fix:

withFix.mov

Fixes #7307

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/contributing/pr
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

@ugur-vaadin ugur-vaadin marked this pull request as ready for review May 16, 2025 07:04
@@ -231,9 +231,13 @@ describe('virtualizer - scrollbar scrolling', () => {
// Sanity check for iron-list internal properties
const adapter = virtualizer.__adapter;
const firstItem = adapter._physicalItems[adapter._physicalStart];
expect(firstItem.__virtualIndex).to.equal(adapter._virtualStart);
expect(firstItem.__virtualIndex).to.closeTo(adapter._virtualStart, 10);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indexes can go out of sync temporarily while scrolling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Grid rows not shown
1 participant