Skip to content
This repository has been archived by the owner on Nov 30, 2020. It is now read-only.

Commit

Permalink
fix(menu): Add role and tabindex
Browse files Browse the repository at this point in the history
  • Loading branch information
matsp committed Jan 25, 2018
1 parent f65d2b5 commit d00a8f8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions components/Menu/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
tabindex="-1"
@MDCSimpleMenu:selected="onSelect"
@MDCSimpleMenu:cancel="onCancel">
<slot
role="menu"/>
<slot />
</div>
</template>

Expand Down Expand Up @@ -42,8 +41,15 @@ export default {
this.$slots.default.map(n => {
n.elm.classList.add('mdc-simple-menu__items')
})
this.$slots.default[0].elm.setAttribute('role', 'menu')
this.$slots.default[0].componentOptions.children.map(n => {
if (n.elm.className.includes('mdc-list-item')) {
n.elm.setAttribute('tabindex', '0')
}
})
}
this.mdcSimpleMenu = MDCSimpleMenu.attachTo(this.$el)
this.mdcSimpleMenu.open = this.open
},
Expand Down

0 comments on commit d00a8f8

Please sign in to comment.