-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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(a11y): inconsistent runtime value for ListKeyManager.activeItem #14154
fix(a11y): inconsistent runtime value for ListKeyManager.activeItem #14154
Conversation
|
||
this._activeItemIndex = index; | ||
this._activeItem = itemArray[index]; | ||
this._activeItem = typeof activeItem === 'undefined' ? null : activeItem; |
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.
this._activeItem = activeItem == null ? null : activeItem;
is shorter no ?
3410334
to
4c7409d
Compare
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.
LGTM
|
||
this._activeItemIndex = index; | ||
this._activeItem = itemArray[index]; | ||
this._activeItem = activeItem == null ? null : activeItem; |
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.
Add a comment like
// Explicitly check for `null` and `undefined` because other falsy values are valid.
The `activeItem` is currently typed to `T | null`, however on init and when assigning incorrect values, the `activeItem` will actually be `undefined` at runtime. These changes add some logic to make sure that the value is consistent with its type. Fixes angular#14152.
4c7409d
to
119005e
Compare
…ngular#14154) The `activeItem` is currently typed to `T | null`, however on init and when assigning incorrect values, the `activeItem` will actually be `undefined` at runtime. These changes add some logic to make sure that the value is consistent with its type. Fixes angular#14152.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The
activeItem
is currently typed toT | null
, however on init and when assigning incorrect values, theactiveItem
will actually beundefined
at runtime. These changes add some logic to make sure that the value is consistent with its type.Fixes #14152.