Permalink
Browse files

feat(v-b-modal): set role="button" if trigger element is not a button

  • Loading branch information...
tmorehouse committed Dec 5, 2017
1 parent c2dd2d0 commit aa45d3e15c4cd160dbe9f220f793facbe326fe7c
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/directives/modal/modal.js
@@ -1,14 +1,19 @@
import target from '../../utils/target'
import { setAttr } from '../../utils/dom'
const listenTypes = {click: true}
export default {
// eslint-disable-next-line no-shadow-restricted-names
bind (undefined, binding, vnode) {
// eslint-disable-next-line no-shadow-restricted-names
bind (el, binding, vnode) {
target(vnode, binding, listenTypes, ({targets, vnode}) => {
targets.forEach(target => {
vnode.context.$root.$emit('bv::show::modal', target, vnode.elm)
})
})
if (el.tagName !== 'BUTTON') {
// If element is not a button, we add `role="button"` for accessibility
setAttr(el, 'role', 'button')
}
}
}

0 comments on commit aa45d3e

Please sign in to comment.