Skip to content
Permalink
Browse files
fix(b-modal): remove role="document" from .modal-content (#5345)
* fix(mdoal): remove `role="document"` from `.modal-content` amd only set `role="dialog"` when `.modal` is visible

* Always leave `role="dialog"` in place
  • Loading branch information
jacobmllr95 committed May 12, 2020
1 parent c5ed437 commit 0c2b406e8dadc274e8433d3a4c414e799d0fa228
Showing 2 changed files with 6 additions and 9 deletions.
@@ -422,15 +422,17 @@ export const BModal = /*#__PURE__*/ Vue.extend({
}
},
computedModalAttrs() {
const { isVisible, ariaLabel } = this

return {
id: this.modalId,
role: 'dialog',
'aria-hidden': this.isVisible ? null : 'true',
'aria-modal': this.isVisible ? 'true' : null,
'aria-label': this.ariaLabel,
'aria-hidden': isVisible ? null : 'true',
'aria-modal': isVisible ? 'true' : null,
'aria-label': ariaLabel,
'aria-labelledby':
this.hideHeader ||
this.ariaLabel ||
ariaLabel ||
// TODO: Rename slot to `title` and deprecate `modal-title`
!(this.hasNormalizedSlot('modal-title') || this.titleHtml || this.title)
? null
@@ -994,7 +996,6 @@ export const BModal = /*#__PURE__*/ Vue.extend({
staticClass: 'modal-content',
class: this.contentClass,
attrs: {
role: 'document',
id: this.modalContentId,
tabindex: '-1'
}
@@ -74,8 +74,6 @@ describe('modal', () => {
expect($content.exists()).toBe(true)
expect($content.attributes('tabindex')).toBeDefined()
expect($content.attributes('tabindex')).toEqual('-1')
expect($content.attributes('role')).toBeDefined()
expect($content.attributes('role')).toEqual('document')

wrapper.destroy()
})
@@ -158,8 +156,6 @@ describe('modal', () => {
expect($content.exists()).toBe(true)
expect($content.attributes('tabindex')).toBeDefined()
expect($content.attributes('tabindex')).toEqual('-1')
expect($content.attributes('role')).toBeDefined()
expect($content.attributes('role')).toEqual('document')

wrapper.destroy()
})

0 comments on commit 0c2b406

Please sign in to comment.