Skip to content
Permalink
Browse files

fix(v-b-toggle): don't override `role` if element has a `role` assign…

…ed (#3889)
  • Loading branch information...
tmorehouse committed Aug 14, 2019
1 parent cf3d4c6 commit 5d155badd671cc60f1f6ab3c294e713ebf7e9915
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/directives/toggle/toggle.js
@@ -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'

@@ -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')
}

0 comments on commit 5d155ba

Please sign in to comment.
You can’t perform that action at this time.