adopted-ember-addons / ember-paper

The Ember approach to Material Design.
https://ember-paper.netlify.app/
MIT License
888 stars 333 forks source link

PaperMenu focusItem breaks if all menu items are disabled #1128

Closed boydkr closed 4 years ago

boydkr commented 4 years ago
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)
-- | --
boydkr commented 4 years ago

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;
    }
boydkr commented 4 years ago

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

miguelcobain commented 4 years ago

Fixed in #1129