Skip to content

Commit 983e02f

Browse files
committed
feat: Add role="dialog" in modals via JavaScript
1 parent 3d8d499 commit 983e02f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

js/src/modal.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ class Modal {
252252
this._element.style.display = 'block'
253253
this._element.removeAttribute('aria-hidden')
254254
this._element.setAttribute('aria-modal', true)
255+
this._element.setAttribute('role', 'dialog')
255256
this._element.scrollTop = 0
256257

257258
if (modalBody) {
@@ -327,6 +328,7 @@ class Modal {
327328
this._element.style.display = 'none'
328329
this._element.setAttribute('aria-hidden', true)
329330
this._element.removeAttribute('aria-modal')
331+
this._element.removeAttribute('role')
330332
this._isTransitioning = false
331333
this._showBackdrop(() => {
332334
document.body.classList.remove(CLASS_NAME_OPEN)

0 commit comments

Comments
 (0)