]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Improve accessibilty - add an aria-describedby attribute on the dialog if...
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Fri, 26 Oct 2012 00:30:10 +0000 (20:30 -0400)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Mon, 26 Nov 2012 09:26:11 +0000 (10:26 +0100)
ui/jquery.ui.dialog.js

index 07c5c7cb6afd12b938205cc0b99afcf40a18c9a7..892dd72b099721f32d6dda4f988815337b0cbe38 100644 (file)
@@ -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" );