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

Commit d00a8f8

Browse files
committed
fix(menu): Add role and tabindex
1 parent f65d2b5 commit d00a8f8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

components/Menu/Menu.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
tabindex="-1"
66
@MDCSimpleMenu:selected="onSelect"
77
@MDCSimpleMenu:cancel="onCancel">
8-
<slot
9-
role="menu"/>
8+
<slot />
109
</div>
1110
</template>
1211

@@ -42,8 +41,15 @@ export default {
4241
this.$slots.default.map(n => {
4342
n.elm.classList.add('mdc-simple-menu__items')
4443
})
44+
this.$slots.default[0].elm.setAttribute('role', 'menu')
45+
46+
this.$slots.default[0].componentOptions.children.map(n => {
47+
if (n.elm.className.includes('mdc-list-item')) {
48+
n.elm.setAttribute('tabindex', '0')
49+
}
50+
})
4551
}
46-
52+
4753
this.mdcSimpleMenu = MDCSimpleMenu.attachTo(this.$el)
4854
this.mdcSimpleMenu.open = this.open
4955
},

0 commit comments

Comments
 (0)