Added optional history.pushState behaviour to Tab.show. #12101
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
history.pushState
updates the browser history and address bar.I found it unusual that the functionality of pressing tabs updating the address bar to this url was unavailable, so that tabs could be more easily treated as a single page nav. I understand this behaviour isn't always necessary, hence the optional usage by adding
follow-url
as an attribute to the anchor which is used to show the tab.Loading the correct tab then works something like this where all tab anchors have
.my_tabs
history.pushState
is HTML5 so wont work in older browsers, however this functionality is implemented at the end of the show method so any javascript error caused by it would't break the primary functionality of tabs. If it were desired for this to implemented for older browsers this stackoverflow post suggests a method which I haven't tested; http://stackoverflow.com/a/136506/1646387