Permalink
Browse files

Autocomplete: Append liveRegion to body to support detached init. Fix…

…es #9590 - Dynamically adding input field breaks auto-complete's accessibility for screen readers
  • Loading branch information...
jzaefferer committed Oct 18, 2013
1 parent b99f825 commit 7b9c810b9ac450d826b6fa0c3d35377178b7e3b3
Showing with 10 additions and 1 deletion.
  1. +9 −0 tests/unit/autocomplete/autocomplete_core.js
  2. +1 −1 ui/jquery.ui.autocomplete.js
@@ -257,6 +257,15 @@ test( "ARIA", function() {
"Live region for multiple values" );
});
test( "ARIA, init on detached input", function() {
expect( 1 );
var element = $( "<input>" ).autocomplete({
source: [ "java", "javascript" ]
}),
liveRegion = element.autocomplete( "instance" ).liveRegion;
equal( liveRegion.parent().length, 1, "liveRegion must have a parent" );
});
test( ".replaceWith() (#9172)", function() {
expect( 1 );
@@ -294,7 +294,7 @@ $.widget( "ui.autocomplete", {
"aria-live": "polite"
})
.addClass( "ui-helper-hidden-accessible" )
.insertBefore( this.element );
.appendTo( this.document[ 0 ].body );
// turning off autocomplete prevents the browser from remembering the
// value when navigating through history, so we re-enable autocomplete

0 comments on commit 7b9c810

Please sign in to comment.