Skip to content

Commit ff11b69

Browse files
committed
Autocomplete: Insert the live region before the input. Fixes #9172 - Autocomplete: .replaceWith() fails to replace.
1 parent f281ce9 commit ff11b69

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tests/unit/autocomplete/autocomplete_core.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,14 @@ test( "ARIA", function() {
188188
"Live region for multiple values" );
189189
});
190190

191+
test( ".replaceWith() (#9172)", function() {
192+
expect( 1 );
193+
194+
var element = $( "#autocomplete" ).autocomplete(),
195+
replacement = "<div>test</div>",
196+
parent = element.parent();
197+
element.replaceWith( replacement );
198+
equal( parent.html(), replacement );
199+
});
200+
191201
}( jQuery ) );

ui/jquery.ui.autocomplete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ $.widget( "ui.autocomplete", {
296296
"aria-live": "polite"
297297
})
298298
.addClass( "ui-helper-hidden-accessible" )
299-
.insertAfter( this.element );
299+
.insertBefore( this.element );
300300

301301
// turning off autocomplete prevents the browser from remembering the
302302
// value when navigating through history, so we re-enable autocomplete

0 commit comments

Comments
 (0)