diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-10-25 20:30:10 -0400 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-11-26 10:26:11 +0100 |
commit | 2a887e43213c4dbb21509b670cf5dc8ac2c67573 (patch) | |
tree | fcf5c5c3197eb3113d5c7e0b90086ac31801b1f4 /ui | |
parent | 62ae078f1472b15cd6513eceeff2b9d270b94d46 (diff) | |
download | jquery-ui-2a887e43213c4dbb21509b670cf5dc8ac2c67573.tar.gz jquery-ui-2a887e43213c4dbb21509b670cf5dc8ac2c67573.zip |
Dialog: Improve accessibilty - add an aria-describedby attribute on the dialog if there is nothing yet in the dialog content. Partial fix for:
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.dialog.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 07c5c7cb6..892dd72b0 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -156,6 +156,15 @@ $.widget("ui.dialog", { "aria-labelledby": uiDialogTitle.attr( "id" ) }); + // We assume that any existing aria-describedby attribute means + // that the dialog content is marked up properly + // otherwise we brute force the content as the description + if ( !this.element.find( "[aria-describedby]" ).length ) { + uiDialog.attr({ + "aria-describedby": this.element.uniqueId().attr( "id" ) + }); + } + uiDialogTitlebar.find( "*" ).add( uiDialogTitlebar ).disableSelection(); this._hoverable( uiDialogTitlebarClose ); this._focusable( uiDialogTitlebarClose ); @@ -205,6 +214,7 @@ $.widget("ui.dialog", { } this.uiDialog.hide(); this.element + .removeUniqueId() .removeClass( "ui-dialog-content ui-widget-content" ) .hide() .appendTo( "body" ); |