cferdinandi / tabby

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

When multiple toggles for one tab are present, only the first toggle on the page gets updated or returned in callbacks #101

Closed JacobDB closed 5 years ago

JacobDB commented 5 years ago

We often switch over to accordions for mobile users, and that requires having two toggles for each tab. This works fairly well, except two things:

  1. The second toggle active class needs to be manually synced with a callback
  2. When a tab gets opened with a secondary toggle, it's impossible to tell with a callback, so special things for different toggles can't occur (for example, scrolling to the top of the tab only on mobile).

I'd really appreciate it if this could be updated to have all toggles linked to a tab included in the callback, and the one that was clicked to have some property denoting that.

cferdinandi commented 5 years ago

This script is slated for a complete rewrite allowing for multiple instantiations, which should hopefully fix issues like this. No timeframe on the rewrite yet, but I'll keep this open as an issue to track against it.

JacobDB commented 5 years ago

Excellent, will keep an eye out for it

cferdinandi commented 5 years ago

I'll make sure to update this issue as part of any update so that you get notified.

cferdinandi commented 5 years ago

v12 is now live. Callbacks have been replaced with custom events.