Skip to content

Commit c2802d7

Browse files
petersendiditscottgonzalez
authored andcommitted
Accordion: handle active: null. Fixes #8694: 1.9 Accordion - active: null allows panels to be collapsible.
1 parent 390510c commit c2802d7

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

tests/unit/accordion/accordion_options.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ test( "{ active: default }", function() {
1313
state( element, 1, 0, 0 );
1414
});
1515

16+
test( "{ active: null }", function() {
17+
expect( 2 );
18+
var element = $( "#list1" ).accordion({
19+
active: null
20+
});
21+
equal( element.accordion( "option", "active" ), 0 );
22+
state( element, 1, 0, 0 );
23+
});
24+
1625
test( "{ active: false }", function() {
1726
expect( 7 );
1827
var element = $( "#list1" ).accordion({

ui/jquery.ui.accordion.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ $.widget( "ui.accordion", {
5959
.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
6060
.hide();
6161

62-
// don't allow collapsible: false and active: false
63-
if ( !options.collapsible && options.active === false ) {
62+
// don't allow collapsible: false and active: false / null
63+
if ( !options.collapsible && ( !options.active || typeof options.active !== "number" ) ) {
6464
options.active = 0;
6565
}
6666
// handle negative values

0 commit comments

Comments
 (0)