Skip to content

fix(cdk/menu): prevent default selection key actions #26051

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

Merged
merged 1 commit into from
Nov 23, 2022

Conversation

crisbeto
Copy link
Member

Fixes that the CDK menu wasn't calling preventDefault on the enter key presses which caused it to immediately close, because it would allow the click handler to fire as well.

Fixes #26033.

Fixes that the CDK menu wasn't calling `preventDefault` on the enter key presses which caused it to immediately close, because it would allow the click handler to fire as well.

Fixes angular#26033.
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Nov 22, 2022
@crisbeto crisbeto requested a review from mmalerba as a code owner November 22, 2022 07:32
@crisbeto crisbeto requested review from devversion and removed request for devversion November 22, 2022 08:03
@zizifn
Copy link
Contributor

zizifn commented Nov 22, 2022

Just curious, does this fix will goto version 14.*?

@crisbeto
Copy link
Member Author

It won't. We generally don't backport fixes unless they're security-related.

Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Nov 23, 2022
@crisbeto crisbeto merged commit 02ab0a2 into angular:main Nov 23, 2022
crisbeto added a commit that referenced this pull request Nov 23, 2022
Fixes that the CDK menu wasn't calling `preventDefault` on the enter key presses which caused it to immediately close, because it would allow the click handler to fire as well.

Fixes #26033.

(cherry picked from commit 02ab0a2)
crisbeto added a commit to crisbeto/material2 that referenced this pull request Dec 20, 2022
In angular#26051 a couple of `preventDefault` calls were added, because we were moving focus within an enter key `keydown` event which was causing the menu to close immediately after it opens. The problem is that the calls also prevent links from navigating.

These changes remove the `preventDefault` calls and resolve the initial issue by ignoring clicks initiated by the keyboard.

Fixes angular#26291.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent 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): cdk menu is not working properly when use keyboard
3 participants