-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maintaining unique tab state #4
Comments
Here is a working Codepen, with it tidied up a little. (Note, because it's a Codepen, I've manually set the second tab being in |
In my testing, I can see some potential accessibility issues with navigating to the tab on page load. I don't know what you think. It could perhaps be better achieved by using URL query parameters instead. There's also the added complication of having more than one |
I shipped a |
This is great. Thank you.
But here's a feature I would love: maintained tab state.
Let's say we have a site for a Bed & Breakfast (
fakebnb.com
), and on one page (fakebnb.com/rooms
) we have the different rooms — each room on a different tab panel. I, a potential guest, go to the site, and really like room no. 2. While on room 2's tab, I send my wife the link in the url bar (fakebnb.com/rooms
) — except when she opens it, it obviously shows room no. 1, because it's the first tab.Because you're doing
event.preventDefault()
when the tab buttons are clicked (or similarly via keyboard), the tabid
isn't being pushed to history. It would be great if we could have the active tab reflected in the history. That way, when you click a tab, it gets pushed to the history (fakebnb.com/rooms#room-2
), and when that link is shared, it opens to the "right" tab.I would propose something like this (obviously tidied up):
Granted, I haven't tested this yet. But would you be open to a PR that implements this?
The text was updated successfully, but these errors were encountered: