-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(cdk/menu): add setActiveMenuItem to cdkMenu #31371
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
Conversation
*/ | ||
setActiveMenuItem(item: number | CdkMenuItem) { | ||
if (this.keyManager) { | ||
if (typeof item === 'number') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need this check, the key manager does it automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes its not needed but typescript is not happy so I had to add.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Let's keep it as is and I'll clean it up later.
4cc5a18
to
64535aa
Compare
64535aa
to
774d0a2
Compare
This is a follow-up to angular#31371 (comment). `ListKeyManager.setActiveItem` supports both a reference to an item or an index, however there's no override that allows `T | number` which can be inconvenient. These changes add extra overrides to resolve the issue.
) This is a follow-up to #31371 (comment). `ListKeyManager.setActiveItem` supports both a reference to an item or an index, however there's no override that allows `T | number` which can be inconvenient. These changes add extra overrides to resolve the issue.
See #31370 for more details