]> source.dussan.org Git - jquery-ui.git/commitdiff
Tooltip: Remove name attribute from elements in the live region
authorJiabao Wu <jiabao.foss@gmail.com>
Wed, 22 Apr 2015 14:20:11 +0000 (10:20 -0400)
committerScott González <scott.gonzalez@gmail.com>
Wed, 22 Apr 2015 14:20:11 +0000 (10:20 -0400)
Fixes #11272
Closes gh-1544

tests/unit/tooltip/core.js
ui/tooltip.js

index fa24d72ce71eb3af612d3585f15254e15c839750..135fa480bb87fe332c004966214bbeca8294dbf5 100644 (file)
@@ -221,4 +221,29 @@ asyncTest( "multiple active delegated tooltips", function() {
        step1();
 });
 
+// http://bugs.jqueryui.com/ticket/11272
+test( "remove conflicting attributes from live region", function() {
+       expect( 2 );
+
+       var element = $(
+               "<div id='content'>" +
+                       "<input type='radio' name='hobby' id='hobby1' checked='checked'>" +
+                       "<label for='hobby1'>option 1</label>" +
+                       "<input type='radio' name='hobby' id='hobby2'>" +
+                       "<label for='hobby2'>option 2</label>" +
+               "</div>" );
+
+       $( "#tooltipped1" )
+               .tooltip({
+                       content: element,
+                       open: function() {
+                               equal( $( ".ui-helper-hidden-accessible [name]" ).length, 0,
+                                       "no name attributes within live region" );
+                               equal( $( ".ui-helper-hidden-accessible [id]" ).length, 0,
+                                       "no id attributes within live region" );
+                       }
+               })
+               .tooltip( "open" );
+});
+
 } );
index 841e877cc2bee7a1b3ac1bef55461338d5a03aca..e18f3e19d8542a7bf79097ee01fef946e7648e0d 100644 (file)
@@ -287,6 +287,7 @@ $.widget( "ui.tooltip", {
                // Voiceover will sometimes re-read the entire log region's contents from the beginning
                this.liveRegion.children().hide();
                a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() );
+               a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" );
                a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
                a11yContent.appendTo( this.liveRegion );