Ticket #5954 (closed bug: fixed)

Opened 3 years ago

Last modified 2 years ago

Load event for Ajax tab can fire for the wrong tab

Reported by: asgeo1 Owned by:
Priority: major Milestone: 1.9.0
Component: ui.tabs Version: 1.8.4
Keywords: Cc: jqueryui@…
Blocking: Blocked by:

Description

The load event for a tab should fire once the ajax tab has been loaded.

Except I have noticed that there is a bug in the 1.8 series which can cause it to fire not for the tab that was loaded - but for the previous tab in the list.

Attached is an example which shows the problem.

The main bit to look for is how the tabs are setup:

<div class="tabs" id="mytabs">
    <ul class="ui-tabs-nav">
        <li class="ui-tabs-nav-item"><a href="#mytab1"><span>MyTab1</span></a></li>
        <li class="ui-tabs-nav-item"><a href="/test.htm"><span>MyTab2</span></a></li>
        <li class="ui-tabs-nav-item"><a href="#mytab3"><span>MyTab3</span></a></li>
    </ul>

    <div id="mytab3"><h1>MyTab3</h1></div>
    <div id="mytab1"><h1>MyTab1</h1></div>
</div>

If you click "!MyTab2", the alert should say "loaded: ui-tabs-1"

Instead it says "loaded: mytab1"

The bug is triggered by placing the panel for #mytab3 before #mytab1.

There seems to be an assumption that the ordering of the tab panels will be the same as the tab links.

But that is not a fair assumption. There are genuine reasons why they may not match.

I never had this bug in 1.7.x, so I assume some change in either jQuery UI 1.8.x or jQuery 1.4.x is causing this.

Let me know what you think.

Regards, -asgeo1

Attachments

jquery_bug.zip Download (105.7 KB) - added by asgeo1 3 years ago.
Demo of this bug in action

Change History

Changed 3 years ago by asgeo1

Demo of this bug in action

comment:1 Changed 2 years ago by scott.gonzalez

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from TBD to 1.9

This is fixed in master.

Note: See TracTickets for help on using tickets.