]> source.dussan.org Git - jquery-ui.git/commitdiff
Autocomplete: Append liveRegion to body to support detached init. Fixes #9590 - Dynam... 1113/head
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Fri, 18 Oct 2013 13:39:20 +0000 (15:39 +0200)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Fri, 18 Oct 2013 22:27:51 +0000 (00:27 +0200)
tests/unit/autocomplete/autocomplete_core.js
ui/jquery.ui.autocomplete.js

index a8b0a733049ac213bb4fbca8cb49ec0b6032b3f2..58e96755a6290e6a9bbf2e616df2209cf43ffb75 100644 (file)
@@ -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 );
 
index d1a3c252db3391ffe0c4e011fb11c77909af0ea1..2b803b62f7df2112234b281cffebfbad3de89a03 100644 (file)
@@ -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