Skip to content
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

fix(cdk/menu): avoid resetting the scroll position when using the mouse #30249

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

crisbeto
Copy link
Member

The CDK menu 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 menu 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 #30130.

The CDK menu 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 menu 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#30130.
@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Dec 30, 2024
@crisbeto crisbeto requested a review from a team as a code owner December 30, 2024 08:01
@crisbeto crisbeto requested review from mmalerba and andrewseguin and removed request for a team December 30, 2024 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: cdk/menu target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(CDK menu): Menu directive breaks scrollbar scrolling behavior
1 participant