Skip to content

Commit f32e4ca

Browse files
authored
Merge pull request bootstrap-vue#1498 from larionov/dev
fix(dropdown): fixed aria-labbeledby for non-split dropdowns
2 parents e311258 + d597dbc commit f32e4ca

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/components/dropdown/dropdown.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default {
6262
class: t.menuClasses,
6363
attrs: {
6464
role: t.role,
65-
'aria-labelledby': t.safeId(split ? '_BV_toggle_' : '_BV_button_')
65+
'aria-labelledby': t.safeId(this.split ? '_BV_toggle_' : '_BV_button_')
6666
},
6767
on: {
6868
mouseover: t.onMouseOver,

src/components/dropdown/dropdown.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,14 @@ describe('dropdown', async () => {
107107

108108
expect(Array.from(dd_6.$refs.menu.children).filter(node => node.classList.contains('dropdown-divider')).length).toBe(1)
109109
})
110+
111+
it('.dropdown menu aria-labelledby should target `_BV_button_` when not in split mode', async () => {
112+
const { app: { $refs } } = window
113+
const { dd_1 } = $refs // eslint-disable-line camelcase
114+
115+
const menu = Array.from(dd_1.$el.children)
116+
.find(node => node.attributes.role && node.attributes.role.value === 'menu')
117+
118+
expect(menu.attributes['aria-labelledby'].value).toMatch(/_BV_button_$/)
119+
})
110120
})

0 commit comments

Comments
 (0)