Skip to content

Commit

Permalink
fix(v-b-toggle): don't override role if element has a role assign…
Browse files Browse the repository at this point in the history
…ed (#3889)
  • Loading branch information
tmorehouse committed Aug 14, 2019
1 parent cf3d4c6 commit 5d155ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/directives/toggle/toggle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import looseEqual from '../../utils/loose-equal'
import { addClass, removeAttr, removeClass, setAttr } from '../../utils/dom'
import { addClass, hasAttr, removeAttr, removeClass, setAttr } from '../../utils/dom'
import { isBrowser } from '../../utils/env'
import { bindTargets, getTargets, unbindTargets } from '../../utils/target'

Expand Down Expand Up @@ -91,7 +91,7 @@ export const VBToggle = {
setAttr(el, 'aria-controls', el[BV_TOGGLE_CONTROLS])
setAttr(el, 'aria-expanded', 'false')
// If element is not a button, we add `role="button"` for accessibility
if (el.tagName !== 'BUTTON') {
if (el.tagName !== 'BUTTON' && !hasAttr(el, 'role')) {
setAttr(el, 'role', 'button')
}

Expand Down

0 comments on commit 5d155ba

Please sign in to comment.