1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-26 06:44:35 +02:00

Add role="dialog" in modals via JavaScript (#30936)

This commit is contained in:
Rohit Sharma
2020-06-04 13:05:09 +05:30
committed by GitHub
parent 358d637d1c
commit 5faf41eb48
4 changed files with 35 additions and 27 deletions

View File

@@ -248,6 +248,7 @@ class Modal {
this._element.style.display = 'block'
this._element.removeAttribute('aria-hidden')
this._element.setAttribute('aria-modal', true)
this._element.setAttribute('role', 'dialog')
this._element.scrollTop = 0
if (modalBody) {
@@ -323,6 +324,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.classList.remove(CLASS_NAME_OPEN)