Skip to content

Bug(menu): Cannot read property 'disabled' of undefined #3317

Closed

Description

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Should not cause an exception

What is the current behavior?

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);
    }
};

What are the steps to reproduce?

Providing a Plunker (or similar) is the best way to get the team to see your issue.
Plunker template: http://plnkr.co/edit/o077B6uEiiIgkC0S06dd

https://material.angular.io/components/component/menu
focus on a menu item then use an arrow key

What is the use-case or motivation for changing an existing behavior?

Need to implement keyboard navigation to go through a menu

Which versions of Angular, Material, OS, browsers are affected?

Angular 2.4.5
Material 2.0.0-beta.2
Windows 10

Chrome Version 56.0.2924.87 (64-bit)
Microsoft Edge 38.14393.0.0
Microsoft EdgeHTML 14.14393

Is there anything else we should know?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

P5The team acknowledges the request but does not plan to address it, it remains open for discussionhelp wantedThe team would appreciate a PR from the community to address this issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions