" ).dialog( { modal: true } );
+ wrapper = element.dialog( "widget" );
+ assert.equal( wrapper.attr( "aria-modal" ), "true", "modal option set to true, aria-modal attribute added" );
+ element.dialog( "option", "modal", false );
+ assert.equal( wrapper.attr( "aria-modal" ), undefined, "modal option set to false, aria-modal attribute not added" );
+ element.dialog( "option", "modal", true );
+ assert.equal( wrapper.attr( "aria-modal" ), "true", "modal option set to true, aria-modal attribute added" );
+ element.remove();
+
+ element = $( "
" ).dialog( { modal: false } );
+ wrapper = element.dialog( "widget" );
+ assert.equal( wrapper.attr( "aria-modal" ), undefined, "modal option set to false, aria-modal attribute not added" );
+ element.dialog( "option", "modal", true );
+ assert.equal( wrapper.attr( "aria-modal" ), "true", "modal option set to true, aria-modal attribute added" );
+ element.dialog( "option", "modal", false );
+ assert.equal( wrapper.attr( "aria-modal" ), undefined, "modal option set to false, aria-modal attribute not added" );
+ element.remove();
+
+ element = $( "
" ).dialog();
+ wrapper = element.dialog( "widget" );
+ assert.equal( wrapper.attr( "aria-modal" ), undefined, "modal option not set, aria-modal attribute not added" );
+ element.dialog( "option", "modal", true );
+ assert.equal( wrapper.attr( "aria-modal" ), "true", "modal option set to true, aria-modal attribute added" );
+ element.dialog( "option", "modal", false );
+ assert.equal( wrapper.attr( "aria-modal" ), undefined, "modal option set to false, aria-modal attribute not added" );
+ element.remove();
+} );
+
QUnit.test( "widget method", function( assert ) {
assert.expect( 1 );
var dialog = $( "
" ).appendTo( "#qunit-fixture" ).dialog();
diff --git a/ui/widgets/dialog.js b/ui/widgets/dialog.js
index 4ba9d11176..756ad1cb10 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() {