[labs/virtualizer] Scrolling to a far away element using scrollIntoView then nothing gets rendered
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 21.8k
- Forks
- 1.1k
- Avg merge
- 18h 25m
- Merged PRs (30d)
- 2
Description
Which package(s) are affected?
Virtualizer (@lit-labs/virtualizer)
Description
When scrolling to a far away element, for example using virtualizer.element(xyz).scrollIntoView then nothing gets rendered,
For example 30000 elements in the list and each element have height 37px. Scrolling to anything above 14984 not working.
(temp2 is the virtualizer ref in the browser console )
temp2.element(14984).scrollIntoView({block: 'center', behavior: 'instant',})
OK, list scrolls and gets rendered correct.
temp2.element(14985).scrollIntoView({block: 'center', behavior: 'instant',})
NOK, list is blanked no elements rendered. Any value >= 14985
At the same time as this problem theres also a printput : err ResizeObserver loop completed with undelivered notifications.
in the console.log
Same problem with scrollToIndex.
Getting a ref to the scrollable element above and using:
scrollabeRef.scrollTop = 37 * 14985 is working
lit-virtualizer is rendered in a lit component as :
<lit-virtualizer
.items=${this.options.option}
.renderItem=${renderItem}
></lit-virtualizer>
The Scrollable element is outside the host component.
Reproduction
Workaround
Using scrollTop on the scrollable (but is not nice because the scrollable is outside the component and we want to scroll from inside the component)
Is this a regression?
No or unsure. This never worked, or I haven't tried before.
Affected versions
2.0.14
Browser/OS/Node environment
edge
chrome
(Reproduction playground does not work at all on firefox when scroll to for example 1000, not sure if this is another issue or problem with repro!?)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Lit playground and reproduce the failure through lit-virtualizer's element(x).scrollIntoView and scrollToIndex entry points, comparing index 14984 with 14985. Investigate the accompanying ResizeObserver warning and verify that far-away elements render correctly without the blank list or warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100