Opened 11 years ago

Closed 9 years ago

#4572 closed bug (fixed)

nested tabsets have ui-state-disabled copied from parent tabset

Reported by: bjscott Owned by:
Priority: major Milestone: 1.8
Component: ui.tabs Version: 1.7.1
Keywords: nested tabs Cc:
Blocked by: Blocking:

Description

If I have a nested tabset and the parent tabset has a bad link (which gets disabled) the nested tabset has the link in the same position disabled. The following code shows this behaviour, the nested tabset in Tab 2 has its second tab disabled incorrectly.

<script type="text/javascript">

$(function() { $('#tabset1').tabs(); $('#tabset2').tabs();

}); </script>

<div id="tabset1">

<ul>

<li><a href="#tab1"><span>Tab 1</span></a></li> <li><a href="#"><span>FAIL</span></a></li> <li><a href="#tab2"><span>Tab 2</span></a></li> <li><a href="#tab3"><span>Tab 3</span></a></li> <li><a href="#tab4"><span>Tab 4</span></a></li>

</ul> <div id="tab1">

content tab1

</div> <div id="tab2">

<div id="tabset2">

<ul>

<li><a href="#tab5"><span>Tab 5</span></a></li> <li><a href="#tab6"><span>Tab 6 (incorrectly disabled)</span></a></li> <li><a href="#tab7"><span>Tab 7</span></a></li> <li><a href="#tab8"><span>Tab 8</span></a></li>

</ul> <div id="tab5">

content tab5

</div> <div id="tab6">

content tab6

</div> <div id="tab7">

content tab7

</div> <div id="tab8">

content tab8

</div>

</div>

</div> <div id="tab3">

content tab3

</div> <div id="tab4">

content tab4

</div>

</div>

Change History (3)

comment:1 Changed 11 years ago by Jörn Zaefferer

Milestone: TBD1.8

Probably some selector that is too greedy and needs to be restricted to children.

comment:3 Changed 10 years ago by rio

It's not a selector that is greedy, nor is this bug limited to nested tabsets. The problem is the fact that $.ui.tabs.defaults.disabled is not deep-copied for each separate instance of the tabs widget. All instances of the widget end up sharing the same array of indices to disabled tabs.

A current workaround is to explicitly pass an empty array in the options to each individual tab, e.g.,

$(".all-tabsets").each(function(){ $(this).tabs({disabled: []}) });

comment:4 Changed 9 years ago by Scott González

Milestone: 1.91.8
Resolution: fixed
Status: newclosed

This was fixed with the widget factory update in 1.8.

Note: See TracTickets for help on using tickets.