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): unable to close child menu with disabled items when us… #28097

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

Conversation

behzadmehrabi
Copy link
Contributor

Fixes #27403.

@behzadmehrabi
Copy link
Contributor Author

@crisbeto I can't figure out why autocomplete api golden checks fails, could you help?
thanks.

@crisbeto
Copy link
Member

crisbeto commented Nov 9, 2023

The check was broken on the main branch. It's fixed now so you need to rebase.

@behzadmehrabi behzadmehrabi force-pushed the fix-cdk-menu-unable-to-close branch 2 times, most recently from b96895b to 169d248 Compare November 9, 2023 15:35
…ing keyboard

Fixes the issue where the child menu remained open when all of its items were disabled.
// If there's no active item at this point, it means that all the items are disabled.
// Move focus to the menuPanel panel so keyboard events like Escape and closing child menus using arrow keys still works.
// Also, this will give _some_ feedback to screen readers.
if (!this.nativeElement.contains(document.activeElement)) {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of going to the DOM, I think that we can check keyManager.activeItem === null here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the delayed response, I tried it but didn't work, the keyManager.activeItem at this point is the child menu trigger button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(cdk/menu): sub menu with disabled items only is not closed when other sub menu is opened
2 participants