Skip to main content

Search and Top Navigation

#8568 closed bug (fixed)

Opened September 12, 2012 01:09PM UTC

Closed October 09, 2012 01:07PM UTC

jQuery ui tabs: wrong default active li if ul contains extraneous elements

Reported by: erethnor Owned by:
Priority: minor Milestone: 1.9.1
Component: ui.tabs Version: 1.9.0
Keywords: Cc:
Blocked by: Blocking:
Description

You can see the problem on this jsFiddle.

There, the second tab is selected by default, when the first should be active instead.

This is caused by this line:

active = this.tabs.eq( active ).index();

replacing it with the line below fixes the problem:

active = this.tabs.index( this.tabs.eq( active ) );

Please do not disregard this as not a bug because there shouldn't be a LI without a A there anyway; in my case the extraneous elements are created by css3pie and I cannot feasibly move them out of the UL.

Attachments (0)
Change History (5)

Changed September 12, 2012 01:29PM UTC by Scott González comment:1

resolution: → fixed
status: newclosed

Tabs: Account for non-tab list items on init. Fixes #8568 - jQuery ui tabs: wrong default active li if ul contains extraneous elements.

Changeset: 7023ed4699b0c52e253ba2b3949d08b3dac2905b

Changed September 12, 2012 01:29PM UTC by scottgonzalez comment:2

milestone: 1.9.0git

Changed October 09, 2012 12:55PM UTC by erethnor comment:3

This needs to be reopened as there is a very similar problem when using the

ui-tabs-active
class to mark one tab as active via HTML on load.

This line:

active = this.tabs.filter( ".ui-tabs-active" ).index();

Should be:

active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );

I tried to browse the code to check if there is more code using

.index()
not strictly enough but couldn't see any - maybe worth a watch from somebody knowing the code more though?

Changed October 09, 2012 01:05PM UTC by scottgonzalez comment:4

milestone: git1.9.1
resolution: fixed
status: closedreopened
version: 1.9.0-rc.11.9.0

Changed October 09, 2012 01:07PM UTC by Scott González comment:5

resolution: → fixed
status: reopenedclosed

Tabs: Handle extraneous list items when using ui-tabs-active to set the initially active tab. Fixes #8568 - jQuery ui tabs: wrong default active li if ul contains extraneous elements.

Changeset: fa62f21e5ad09e5368efc3079859730e23a7123b