Skip to content

fix(cdk/listbox): avoid resetting scroll position when using mouse #30903

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

SergheiGurgurov
Copy link

The CDK listbox has some logic that forwards focus to the first item when the host is focused. The problem is that every time the user clicks on the scrollbar, they blur the current item and focus the listbox which then forwards focus back to the first item which in turn causes the scroll position to jump to the top. These changes add some logic to not forward focus when focus comes from a mouse interaction.

Fixes #30900

Fixes a bug in the select component that makes it shrink on scroll
and not grow back when it get's back into view

Fixes angular#30901
The CDK listbox has some logic that forwards focus to the first item when the host is focused.
The problem is that every time the user clicks on the scrollbar, they blur the current item and focus the listbox
which then forwards focus back to the first item which in turn causes the scroll position to jump to the top.
These changes add some logic to not forward focus when focus comes from a mouse interaction.

Fixes angular#30900
@SergheiGurgurov SergheiGurgurov requested a review from a team as a code owner April 18, 2025 23:40
@SergheiGurgurov SergheiGurgurov requested review from mmalerba and wagnermaciel and removed request for a team April 18, 2025 23:40
@mmalerba mmalerba removed their request for review April 21, 2025 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(cdk/listbox): using scrollbar with mouse breaks
1 participant