cferdinandi / tabby

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

Browser Back doesn't active start tab #93

Closed uncenteredDiv closed 5 years ago

uncenteredDiv commented 7 years ago

Steps for reproduces:

  1. Open Demo http://cferdinandi.github.io/tabby/ (Tab "Super Heros" is active)
  2. Change to Tab "Ice Cream"
  3. Change to Tab "Seasons"
  4. Browser Back (Tab "Ice Cream" gets active)
  5. Browser Back (Tab "Super Heros" doesn't get active - Tab "Ice Cream" stays active)

Tried to fix this the following - tabby.js Line 408:

if( !hash ) {
var toggle = document.querySelector( settings.selectorToggle );
hash = toggle.href;
} else {
var toggle = document.querySelector( settings.selectorToggle + '[href*="' + hash + '"]' );  
}

But through that i lost the possibility to set an other Tab active than the first one.

Any ideas?

cferdinandi commented 7 years ago

This is expected behavior, as no hash change is triggered.

I do see what you're saying though. I'll have to give this one some more thought. Full disclosure, this is lower priority for me given a few other things on my plate right now.

cferdinandi commented 5 years ago

Browser button navigation breaks accessibility expectations and is being removed in a complete rewrite that's coming tomorrow. As such, I'm closing this ticket.