Skip to content

MultiSelect: With Virtual Scroll enabled, does not scroll selected item into view #19586

@FredeX

Description

@FredeX

Describe the bug

When using MultiSelect with Virtual Scroll enabled and the dropdown is opened with at least one selected item, it is NOT scrolled into view.

Interesting:

  1. When I switch the browser tab with the dropdown open and come back, the selected item is correctly scrolled into view. Maybe a delay or update issue?
  2. This does not happen when using Select, only MultiSelect.

Pull Request Link

No response

Reason for not contributing a PR

  • Lack of time
  • Unsure how to implement the fix/feature
  • Difficulty understanding the codebase
  • Other

Other Reason

I'm currently not sure what exactly is causing this. If I find out the reason and a way to fix this, I will gladly create a PR to fix this issue!

Reproducer

https://stackblitz.com/edit/github-f8iuaz6x?file=src%2Fapp%2Fapp.component.ts

Environment

Windows 11

Angular version

21.2.10

PrimeNG version

v21

Node version

24.14.0

Browser(s)

No response

Steps to reproduce the behavior

  1. Open the MultiSelect dropdown
  2. Select an option at the bottom (e.g. #99999, the last one)
  3. Close the dropdown
  4. Reopen the MultiSelect dropdown

(This can also be reproduced in the official PrimeNG documentation https://primeng.org/multiselect#virtualscroll)

Expected behavior

When the dropdown of a MultiSelect with Virtual Scroll enabled is opened and (at least) one item is already selected, it is correctly scrolled into view.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugIssue contains a bug related to a specific component. Something about the component is not working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions