Skip to main content

Search and Top Navigation

#5755 closed bug (fixed)

Opened June 23, 2010 10:42AM UTC

Closed September 03, 2010 05:36PM UTC

Last modified November 19, 2010 06:26PM UTC

Tabs: tabs with an empty href are enabled in IE6/7

Reported by: chrismckee Owned by:
Priority: minor Milestone: 1.8.5
Component: ui.tabs Version: 1.8.2
Keywords: ie8, tabs, disabled Cc:
Blocked by: Blocking:

As per this forum thread

(feel free to move this to jquery core if its more appropriate)

I had the same issue. I think I have a good idea why this is happening. It appears that the tabs plugin is using the jquery.inArray() method and expecting the return response to be -1 if the value is not found. This works as expected in other browsers, but IE is returning undefined. I think this is more an issue with the inArray method in jquery core. A simple patch to the method in the core would solve the problem, and is probably the way to go, but I felt more comfortable patching the tabs plugin. My solution is as follows:

Somewhere around line # 7051 in the combined version of ui code is:

// disable tabs
  for (var i = 0, li; (li = this.lis[i]); i++) {
   $(li)[$.inArray(i, o.disabled) != -1 &&
    !$(li).hasClass('ui-tabs-selected') ? 'addClass' : 'removeClass']('ui-state-disabled');

I added a check for the undefined value, replacing the above code with:

 for (var i = 0, li; (li = this.lis[i]); i++) {
   $(li)[$.inArray(i, o.disabled) != -1 && $.inArray(i, o.disabled) != undefined &&
    !$(li).hasClass('ui-tabs-selected') ? 'addClass' : 'removeClass']('ui-state-disabled');

and everything worked in IE as expected.

Hope this helps.

Attachments (0)
Change History (6)

Changed July 28, 2010 12:55AM UTC by scottgonzalez comment:1

priority: criticalminor

This has been repeatedly shown to work, but hasn't been shown to break. I've posted in the forum asking (again) for someone to create an example of the problem.

Changed September 03, 2010 04:10PM UTC by srycroft comment:2

It's actually an IE <= 7 bug that enables tabs when it shouldn't with dynamically created HTML and an href of '#'


Go to IE 8 and switch between IE 7 and IE 8 browser mode to see the tabs enabled and disabled.

The problem code is in _tabify in the section that is trying to deal with an IE <= 7 href issue. It's setting the href variable to a.hash, which is blank. The code later thinks that this is a valid ajax tab, and enables it, instead of disabling it.

Changed September 03, 2010 05:34PM UTC by scottgonzalez comment:3

summary: IE8 Tabs Disabled by defaultTabs: tabs with an empty href are enabled in IE6/7

Changed September 03, 2010 05:36PM UTC by scottgonzalez comment:4

milestone: TBD1.9
resolution: → fixed
status: newclosed

Fixed in 1b31765.

Thanks for tracking down the real problem, srycroft.

Changed September 10, 2010 05:26PM UTC by scottgonzalez comment:5


Changed November 19, 2010 06:26PM UTC by Scott González comment:6

Tabs: Handle empty hrefs for IE6/7 as invalid. Fixes #5755 - Tabs: tabs with an empty href are enabled in IE6/7.

Changeset: 1b3176565561ccbd0c904620ae97690aff41b90b