Autocomplete: Insert the live region before the input. Fixes #9172 - Autocomplete: .replaceWith() fails to replace.

(cherry picked from commit ff11b69a67)
This commit is contained in:
Scott González 2013-03-21 15:54:50 -04:00
parent 25f6c509c1
commit 2da014b11d
2 changed files with 11 additions and 1 deletions

View File

@ -188,4 +188,14 @@ test( "ARIA", function() {
"Live region for multiple values" );
});
test( ".replaceWith() (#9172)", function() {
expect( 1 );
var element = $( "#autocomplete" ).autocomplete(),
replacement = "<div>test</div>",
parent = element.parent();
element.replaceWith( replacement );
equal( parent.html(), replacement );
});
}( jQuery ) );

View File

@ -296,7 +296,7 @@ $.widget( "ui.autocomplete", {
"aria-live": "polite"
})
.addClass( "ui-helper-hidden-accessible" )
.insertAfter( this.element );
.insertBefore( this.element );
// turning off autocomplete prevents the browser from remembering the
// value when navigating through history, so we re-enable autocomplete