cferdinandi / tabby

Lightweight, accessible vanilla JS toggle tabs.
MIT License
599 stars 73 forks source link

tabby.toggleTab() prevents from clicking previous active tab #91

Closed roland-d closed 5 years ago

roland-d commented 7 years ago

Title says it all :)

Steps to reproduce using the Unstructured list tabs:

  1. Go to http://cferdinandi.github.io/tabby
  2. In the Unstructured list click on Seasons
  3. Tab now changes to seasons
  4. Open the Console
  5. Execute the code tabby.toggleTab('#tab2')
  6. The page now shows

Ice Cream

Chocolate, vanilla or strawberry?



7. Click on the Seasons tab
8. Nothing happens
9. Click on Superheroes
10. This works
11. Click on Seasons tab
12. Now this works as well
cferdinandi commented 7 years ago

Ah, good catch! Can't commit to a completion date on this, but it's a fairly simple fix.

roland-d commented 7 years ago

@cferdinandi Thank you for confirming this is an issue.

roland-d commented 7 years ago

@cferdinandi Just wanting to give this a friendly nudge :) Since you said it is a fairly simple fix, is there anything I could put in as a quick fix? Thanks.

dskvr commented 6 years ago

This is definitely a huge issue, sets id to null

dskvr commented 6 years ago

For anyone that cares, this particular problem is at line 403

I changed line 403 to the following:

if ( tab && tab.getAttribute( 'data-tab-id' )) {

I don't understand the full scope of the script, but that doesn't seem to have any negative side effects. Cheers

cferdinandi commented 6 years ago

In its current form, the script removes the id to avoid page jumping, and then resets it when complete. If you comment out line 404, you break resetting the ID. Your check for the data-tab-id is the right way to address this for the moment, until I get a proper fix in place.

Sorry for the delay. Been heads down on my JavaScript guides and courses.

cferdinandi commented 5 years ago

So like... a year and a half too late here, but a fix for this is coming tomorrow

cferdinandi commented 5 years ago

Fixed with v12: https://github.com/cferdinandi/tabby/releases/tag/v12.0.0