I will assume you used scrollIntoView()
with the behavior: 'smooth'
option from the README:
virtualizer.element(42).scrollIntoView({
block: 'center',
behavior: 'smooth',
});
Because Virtualizer works by directly manipulating the absolute positions of its light-DOM child elements aka rendered items, its use of computed styles or observances by the ResizeObserver, which are how it identifies moments to recalibrate due to possible visibility changes, may conflict with some animation approaches if they were applied directly to children in CSS.
However, if you are able to apply your CSS animation/transitions to the containing element, i.e. the <lit-virtualizer>
custom element itself or the containing element of the virtualize()
directive if that was used, you may be able to create the effect you want.
In this video I am doing a very broad overview of Virtualizer, but at the specific time in the link 5:24 I am trying to show visually that Virtualizer is basically just a big container that pretends to hold all the children and if you can control the position of that container in the viewport then CSS animations transitions for that container element should function as expected.
https://www.youtube.com/watch?v=ay8ImAgO9ik&t=324s
If scroller: true
then it is trickier as a separate container element is used inside.
If you have more details you can share about your use case, I'd be interested in reviewing it further as an issue at https://github.com/lit/lit/issues