After upgrading from 3.5 to 3.6 there is an issue if there are "holes" in the numbering of quicktabs due to a hidden tab (no content). In these cases when switching tab hides the content and it stay hidden.

Settings to reproduce:
- Ajax: NO
- Hide empty tabs: YES

I have four tabs:
- Tab1 (get id 0 in hash)
- Tab2 (get id 1 in hash)
- Tab3 (get id 2 in hash), no content - will be hidden
- Tab4 (get id 3 in hash)

After clicking on one of the tabs the DOM looks like this:

<div id="quicktabs-container-quicktabs_tab" class="quicktabs_main quicktabs-style-zen">
 <div id="quicktabs-tabpage-quicktabs_tab-0" class="quicktabs-tabpage quicktabs-hide">
 <div id="quicktabs-tabpage-quicktabs_tab-1" class="quicktabs-tabpage quicktabs-hide">
 <div id="quicktabs-tabpage-quicktabs_tab-3" class="quicktabs-tabpage quicktabs-hide">
</div>

Notice that all have the class "quicktabs-hide".
This doesn't happens if there isn't gaps in the id-values.

After reverting the changes from 3.5->3.6 it works again.

--- a/www/sites/all/modules/quicktabs/js/quicktabs.js
+++ b/www/sites/all/modules/quicktabs/js/quicktabs.js
@@ -57,11 +57,12 @@ Drupal.quicktabs.tab = function (el) {
   this.tabIndex = el.myTabIndex;
   var qtKey = 'qt_' + el.qt_name;
   var i = 0;
-  for (var i = 0; i < Drupal.settings.quicktabs[qtKey].tabs.length; i++) {
+  for (var key in Drupal.settings.quicktabs[qtKey].tabs) {
     if (i == this.tabIndex) {
-      this.tabObj = Drupal.settings.quicktabs[qtKey].tabs[i];
-      this.tabKey = i;
+      this.tabObj = Drupal.settings.quicktabs[qtKey].tabs[key];
+      this.tabKey = key;
     }
+    i++;
   }
   this.tabpage_id = 'quicktabs-tabpage-' + el.qt_name + '-' + this.tabKey;
   this.container = $('#quicktabs-container-' + el.qt_name);

/Johan

Comments

denko_z’s picture

I confirm both the issue and workaround

shotokai’s picture

StatusFileSize
new767 bytes

Attaching a patch (file) based on johan.wilfer patch (code) above.

shotokai’s picture

Status: Active » Needs review
StatusFileSize
new767 bytes

Updating issue status so patch will be reviewed.

capellic’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Thanks for the patch. Had this exact same problem. Applied. Works well.

cafuego’s picture

Me three, thank you.

fls’s picture

same here. after applying the patch everything works fine.

fmb’s picture

Worked for me too, thank you shotokai.

philsward’s picture

Awesome! #3 works beautifully :-)

jaysonjaynes’s picture

#3 worked for me as well. Thanks again, skotokai and johan.wilfer!

erykmynn’s picture

#3 worked like a charm! -- pretty annoying update bug. Hopefully it gets wrapped in a new release.

drywall’s picture

What erykmynn just said in #10.

aasarava’s picture

#3 works. Please commit!

supradhan’s picture

Awesome job. #3 works as charm.

deggertsen’s picture

Thank you. #3 works.

nicxvan’s picture

Another plus for #3
Can we commit this?

sillygwailo’s picture

I can confirm that it works, using the patch at #3 on 3.6 fixes the issue of the quicktabs-hide not being removed on tabs that don't have a sequential ID.

ultimateboy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the work on this all. Sorry it's taken so long to get this committed.

I've gone ahead and committed #3 to 7.x-3.x.

http://drupalcode.org/project/quicktabs.git/commit/aeeaaa94a2c580c140aa2...

cafuego’s picture

Yay, thank you :-)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Sumit kumar’s picture

Yaa Thanks #3 patch works fine.

charles1988’s picture

The patch #2 worked for me

sardis’s picture

Report from 2016 year. Patch #3 is still working, saving the people.