Skip to content

_getAnchor: negative _first when calling scrollToIndex #142

@jpzwarte

Description

@jpzwarte

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) using virtualizer.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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions