You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug(menu): Cannot read property 'disabled' of undefined #3317
P5The team acknowledges the request but does not plan to address it, it remains open for discussionhelp wantedLabel noting an issue which the team is looking for contribution from the community to fix
Causes an exception:
Cannot read property 'disabled' of undefined in the following function:
ListKeyManager.prototype._setActiveInWrapMode = function (delta, items) {
// when active item would leave menu, wrap to beginning or end
this._activeItemIndex =
(this._activeItemIndex + delta + items.length) % items.length;
// skip all disabled menu items recursively until an enabled one is reached
if (items[this._activeItemIndex].disabled) {
this._setActiveInWrapMode(delta, items);
}
else {
this.setActiveItem(this._activeItemIndex);
}
};
Sorry @kara, I was wondering why mouse users could not see the focus on click or not navigate with keys.
I normally click on a menu, then, I use keys to navigate.
PS: If we remove the condition, the menu works nice on mouse click and it seems to fix this issue.
Update: On Menu AngularJS the behaviour is open on click, then focus by default.
@leocaseiro Removing the condition fixes the problem, but the behavior is not perfect because the first focused element will stay active if the mouse hovers over another item. In material1 it works nice, you are right.
I ran into this while working on another issue. The problem is that we have a check for null a little bit down, but the _activeItemIndex is undefined by default. I've fixed it here, but I'll backport it since it's a quick fix and the other PR may take longer to go through.
P5The team acknowledges the request but does not plan to address it, it remains open for discussionhelp wantedLabel noting an issue which the team is looking for contribution from the community to fix
Activity
dahaupt commentedon Feb 26, 2017
@userexperiences I can't reproduce this (tested in Google Chrome and Microsoft Edge). Can you provide more information?
kara commentedon Feb 26, 2017
Yeah, I'm not able to get the error either. More information to repro?
holo-michael-simarta commentedon Feb 26, 2017
Sorry, it's just the up and down arrow keys, make sure the menu is still open and an item is in focus.
HumanMedia commentedon Feb 27, 2017
Yes I can reproduce. One step has been left out.
leocaseiro commentedon Mar 2, 2017
I thought the
<md-menu>and the<md-select>were sharing the samehtml. As it doesn't happen with<md-select>.leocaseiro commentedon Mar 2, 2017
Sorry @kara, I was wondering why mouse users could not see the focus on click or not navigate with keys.
I normally click on a menu, then, I use keys to navigate.
PS: If we remove the condition, the menu works nice on mouse click and it seems to fix this issue.
dahaupt commentedon Mar 2, 2017
@leocaseiro Removing the condition fixes the problem, but the behavior is not perfect because the first focused element will stay active if the mouse hovers over another item. In material1 it works nice, you are right.
crisbeto commentedon Mar 4, 2017
I ran into this while working on another issue. The problem is that we have a check for
nulla little bit down, but the_activeItemIndexisundefinedby default. I've fixed it here, but I'll backport it since it's a quick fix and the other PR may take longer to go through.fix(list-key-manager): exception when no initial active item
fix(list-key-manager): exception when no initial active item (#3431)
Sync to master (#3505)
sync from upstream (#1)
angular-automatic-lock-bot commentedon Sep 5, 2019
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.