Skip to content

Commit

Permalink
fix(b-modal): remove role="document" from .modal-content (#5345)
Browse files Browse the repository at this point in the history
* 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 0c2b406
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 6 additions & 5 deletions src/components/modal/modal.js
Expand Up @@ -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
Expand Down Expand Up @@ -994,7 +996,6 @@ export const BModal = /*#__PURE__*/ Vue.extend({
staticClass: 'modal-content',
class: this.contentClass,
attrs: {
role: 'document',
id: this.modalContentId,
tabindex: '-1'
}
Expand Down
4 changes: 0 additions & 4 deletions src/components/modal/modal.spec.js
Expand Up @@ -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()
})
Expand Down Expand Up @@ -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()
})
Expand Down

0 comments on commit 0c2b406

Please sign in to comment.