Skip to content

Commit 2cef124

Browse files
Jiabao Wuscottgonzalez
Jiabao Wu
authored andcommitted
Tooltip: Remove name attribute from elements in the live region
Fixes #11272 Closes jquerygh-1544
1 parent adcc8ef commit 2cef124

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tests/unit/tooltip/core.js

+25
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,29 @@ asyncTest( "multiple active delegated tooltips", function() {
221221
step1();
222222
});
223223

224+
// http://bugs.jqueryui.com/ticket/11272
225+
test( "remove conflicting attributes from live region", function() {
226+
expect( 2 );
227+
228+
var element = $(
229+
"<div id='content'>" +
230+
"<input type='radio' name='hobby' id='hobby1' checked='checked'>" +
231+
"<label for='hobby1'>option 1</label>" +
232+
"<input type='radio' name='hobby' id='hobby2'>" +
233+
"<label for='hobby2'>option 2</label>" +
234+
"</div>" );
235+
236+
$( "#tooltipped1" )
237+
.tooltip({
238+
content: element,
239+
open: function() {
240+
equal( $( ".ui-helper-hidden-accessible [name]" ).length, 0,
241+
"no name attributes within live region" );
242+
equal( $( ".ui-helper-hidden-accessible [id]" ).length, 0,
243+
"no id attributes within live region" );
244+
}
245+
})
246+
.tooltip( "open" );
247+
});
248+
224249
} );

ui/tooltip.js

+1
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ $.widget( "ui.tooltip", {
287287
// Voiceover will sometimes re-read the entire log region's contents from the beginning
288288
this.liveRegion.children().hide();
289289
a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() );
290+
a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" );
290291
a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
291292
a11yContent.appendTo( this.liveRegion );
292293

0 commit comments

Comments
 (0)