1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-10-01 15:56:45 +02:00
Add role="dialog" in modals via JavaScript
This commit is contained in:
XhmikosR
2020-06-04 10:41:47 +03:00
parent 288b9b82b5
commit 8bc6dcd280
4 changed files with 41 additions and 22 deletions

View File

@@ -265,6 +265,7 @@ class Modal {
this._element.style.display = 'block'
this._element.removeAttribute('aria-hidden')
this._element.setAttribute('aria-modal', true)
this._element.setAttribute('role', 'dialog')
if ($(this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) {
modalBody.scrollTop = 0
@@ -344,6 +345,7 @@ class Modal {
this._element.style.display = 'none'
this._element.setAttribute('aria-hidden', true)
this._element.removeAttribute('aria-modal')
this._element.removeAttribute('role')
this._isTransitioning = false
this._showBackdrop(() => {
$(document.body).removeClass(CLASS_NAME_OPEN)