diff options
author | Ralf Koller <1665422+rpkoller@users.noreply.github.com> | 2024-06-14 13:04:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-14 13:04:00 +0200 |
commit | 376f142b9de42241a20efa9c89644ff5425da174 (patch) | |
tree | 129292775f86739ece147a04442c13039428d4c0 /ui | |
parent | 1f251ca399ec01c75d24293e49ac767938a547e2 (diff) | |
download | jquery-ui-376f142b9de42241a20efa9c89644ff5425da174.tar.gz jquery-ui-376f142b9de42241a20efa9c89644ff5425da174.zip |
Dialog: Add aria-modal support
Reflect the `modal` dialog option into the `aria-modal` attribute -
when `modal` is `true`, set `aria-modal` to `"true"`.
This helps some accessibility tools like VoiceOver with their rotor
functionality as it reduces the number of elements presented.
Fixes gh-2246
Closes gh-2257
Co-authored-by: Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/widgets/dialog.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/widgets/dialog.js b/ui/widgets/dialog.js index 4ba9d1117..756ad1cb1 100644 --- a/ui/widgets/dialog.js +++ b/ui/widgets/dialog.js @@ -347,7 +347,8 @@ $.widget( "ui.dialog", { // Setting tabIndex makes the div focusable tabIndex: -1, - role: "dialog" + role: "dialog", + "aria-modal": this.options.modal ? "true" : null } ) .appendTo( this._appendTo() ); @@ -762,6 +763,10 @@ $.widget( "ui.dialog", { if ( key === "title" ) { this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) ); } + + if ( key === "modal" ) { + uiDialog.attr( "aria-modal", value ? "true" : null ); + } }, _size: function() { |