adopted-ember-addons/ember-paper

PaperMenu focusItem breaks if all menu items are disabled

Closed this issue · 3 comments

Source: | TypeError: Cannot read property 'firstElementChild' of null
at PaperMenuContent.focusItem (http://localhost:4200/e/assets/vendor.js:184488:76)
at Object.installModifier (http://localhost:4200/e/assets/vendor.js:144529:7)
at InteractiveCustomModifierManager.install (http://localhost:4200/e/assets/vendor.js:26681:16)
at Transaction.commit (http://localhost:4200/e/assets/vendor.js:66670:17)
at Environment$1.commit (http://localhost:4200/e/assets/vendor.js:66740:19)
at Environment$1.commit (http://localhost:4200/e/assets/vendor.js:22680:15)
at InteractiveRenderer._renderRoots (http://localhost:4200/e/assets/vendor.js:24178:15)
at InteractiveRenderer._renderRootsTransaction (http://localhost:4200/e/assets/vendor.js:24207:14)
at InteractiveRenderer._revalidate (http://localhost:4200/e/assets/vendor.js:24253:12)
at invoke (http://localhost:4200/e/assets/vendor.js:70227:16)
-- | --

It looks like this happens when it attempts to set the default focusTarget element as the first non-disabled child:

// default to first non disabled item
    if (!focusTarget) {
      focusTarget = element.querySelector('md-menu-item:not([disabled])').firstElementChild;
    }

A workaround is manually assigning the '.md-menu-focus-target' element

Fixed in #1129