Upon upgrading from rc3 to the latest dev (2009-Jul-18), I noticed that all tab links automatically get the "active" attribute, even though only one tab list item is active.

I was able to reproduce this on all quicktabs of the site, whether AJAX-enabled or not. Is that intended or a bug?

CommentFileSizeAuthor
#6 active_tab.patch1.59 KBMichaelP

Comments

pasqualle’s picture

This is a problem in rc3 also..

if was probably introduced with http://drupal.org/cvs?commit=182218 when we fixed the clean URL problem with using the l() function. As all tabs link to the current page therefore all links get the "active" attribute automatically, see http://api.drupal.org/api/function/l/6
So I am not sure if we need to fix this, as the links should be active if we compare the current path with the tab links..

infojunkie’s picture

Status: Active » Closed (fixed)

OK. Thanks for your help.

PixelClever’s picture

Status: Closed (fixed) » Active

It seems to me that even if the active class is being assigned by default there should still be a class assigned to the a tag that sets it as truly active something like .current or .qt_active . Just my take on it.

dotpex’s picture

Version: 6.x-2.x-dev » 6.x-2.0-rc5
Category: support » bug
Priority: Normal » Minor
Status: Active » Needs review

I have a simple fix for proper active class on a element.

in quicktabs.module -> function theme_quicktabs_tabs change line:

  $output .= '<li'. $attributes_li .'>'. l($tab['title'], $_GET['q'], $options) .'</li>'; 

to:

  $options['attributes']['class'] .= ($tabkey == $active_tab ? ' active' : '');
  $output .= '<li'. $attributes_li .'>'. l($tab['title'], $_GET['q'] . $tabkey, $options) .'</li>';    //   append $tabkey to link

and i quicktabs.js find:

  // Set clicked tab to active.
  $(this).parents('li').siblings().removeClass('active');
  $(this).parents('li').addClass('active');

and append two lines:

  // Set clicked tab to active.
  $(this).parents('li').siblings().removeClass('active');
  $(this).parents('li').addClass('active');
  $(this).parents('li').siblings().find('a').removeClass('active');
  $(this).addClass('active');
XiaN Vizjereij’s picture

Priority: Minor » Major
Status: Needs review » Reviewed & tested by the community

Ran into the same problem and got it fixed by the comment above. Thank you very much.

MichaelP’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.59 KB

@dotpex's fix #4 works fine for me, here it is rolled into a patch against 6.x-2.0-rc5.

Many thanks.

katbailey’s picture

Unfortunately this approach will not work when js is disabled. We can't simply change the href of the link - if you're originally on node/1, the tabs will be linking to node/10, node/11, node/12 etc...

XiaN Vizjereij’s picture

katbaily : That might be due to http://drupal.org/node/909410#comment-3711120. Try going back to RC4 and see if the problem still exists.

katbailey’s picture

@XiaN from the comment you linked to:

the tabid is getting added to the node url on ajax tabs

I could be wrong but what seems most likely to me is that this was happening in your case because you had applied the patch from #6 above. This does not happen with a regular rc5. Can you please check this and if this is the case please follow up in that other issue.

XiaN Vizjereij’s picture

Sorry, but currently I don't have an active project that uses QuickTabs, so i can't test it :(

katbailey’s picture

@XiaN, if you're not even going to take the time to confirm the issues you're posting comments about in these threads, please don't comment on them. You are just adding confusion and making it harder for me to ascertain what is and isn't an issue that needs my attention.

XiaN Vizjereij’s picture

I literally launched a new website design today on the urgent request of a customer. I planed to using quicktabs there, but removed it, because i couldn't finish the feature in time ( i had 2 more weeks, but he launched an advertisement campaign containing the new website images without letting me know ).

I'm very sorry. I had QuickTabs on an active project at the time i posted the comment :(

katbailey’s picture

Version: 6.x-2.0-rc5 » 6.x-3.x-dev
Priority: Major » Normal
Status: Needs review » Needs work

I am very tempted to mark this as "won't fix" as to me it seems like this is really core's bug, i.e. not being able to override this side effect of the l() function. I won't be fixing it in the 2.x branch anyway, that's fairly certain at this point.

avpaderno’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

I am closing this issue, since it's for a Drupal version no longer supported.