Skip to content

Commit

Permalink
Dialog: Improve accessibilty - add an aria-describedby attribute on t…
Browse files Browse the repository at this point in the history
…he dialog if there is nothing yet in the dialog content. Partial fix for:
  • Loading branch information
jzaefferer committed Nov 26, 2012
1 parent 62ae078 commit 2a887e4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ui/jquery.ui.dialog.js
Expand Up @@ -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 );
Expand Down Expand Up @@ -205,6 +214,7 @@ $.widget("ui.dialog", {
}
this.uiDialog.hide();
this.element
.removeUniqueId()
.removeClass( "ui-dialog-content ui-widget-content" )
.hide()
.appendTo( "body" );
Expand Down

0 comments on commit 2a887e4

Please sign in to comment.