-
Notifications
You must be signed in to change notification settings - Fork 13
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
_getAnchor: negative _first
when calling scrollToIndex
#142
Comments
Thanks for the bug report, @jpzwarte. I don't suppose you have a repro case we can run? A minimal repro in the Lit Playground would be ideal, but anything is better than nothing. We've recently been working on a pretty thorough overhaul of virtualizer's "scroll-to" functionality, including a way to declaratively specify the scroll position on the initial render. I think this should meet your needs, but I'd like to make sure these issues in the imperative case are handled as well. |
Sounds good! I need to debug the situation a bit more. Seeing some other weird stuff that I'm not sure is not related to the way I provide the |
@graynorton affaict, what happens is that when calling The first
|
@jpzwarte did you find a solution for this issue? |
I'm working on a combo-box component. The overlay contains a
<lit-virtualizer>
element with the list. When I open the overlay and there is a selected item, I scroll the virtualizer to that item (centered) usingvirtualizer.scrollToIndex(selectedIndex, 'center');
Now if I do this, before the overlay is visible, I get the
_getAnchor: negative _first
message in the console and it scrolls to the incorrect location. When I do this after the overlay is visible, it scrolls to the correct item in the list, but it "jumps": the original position of the list is briefly visible. See the video below.Screen.Recording.2022-05-20.at.16.54.02.mov
The text was updated successfully, but these errors were encountered: