Skip to content

Commit 9060bf3

Browse files
committed
Buttonset: Ignore hidden buttons. Fixes #5946 - buttonset should ignore buttons that are not :visible.
1 parent 7692b6e commit 9060bf3

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

tests/unit/button/button_tickets.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55

66
module("button: tickets");
77

8-
8+
test("#5946 - buttonset should ignore buttons that are not :visible", function() {
9+
$( "#radio01" ).next().wrap( "<div></div>" ).parent().hide();
10+
var set = $( "#radio0" ).buttonset();
11+
ok( set.find( "label:eq(0)" ).is( ".ui-button:not(.ui-corner-left)" ) );
12+
ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) );
13+
});
914

1015
})(jQuery);

ui/jquery.ui.button.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,13 @@ $.widget( "ui.buttonset", {
339339
return $( this ).button( "widget" )[ 0 ];
340340
})
341341
.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
342-
.filter( ":first" )
343-
.addClass( "ui-corner-left" )
344-
.end()
345-
.filter( ":last" )
346-
.addClass( "ui-corner-right" )
342+
.filter( ":visible" )
343+
.filter( ":first" )
344+
.addClass( "ui-corner-left" )
345+
.end()
346+
.filter( ":last" )
347+
.addClass( "ui-corner-right" )
348+
.end()
347349
.end()
348350
.end();
349351
},

0 commit comments

Comments
 (0)