Previously the URL fragment wasn't being set as part of the token, so links such as <a href="#section-1">link</a> would get completely ignored.
Similarly if there was a fragment, it would be stripped out on navigating back since the tokens in the stack didn't know about it.
I'm not sure if this was intentional, or just a vestige of using the hash for history in old browsers, but pushy is configured not to use the fragment so I can't see a reason not to use it as it was originally intended. In any event it's been useful for me.
Note that the preventDefault on L133 prevents the browser from jumping to the corresponding DOM element when there's a fragment, but it's simple enough to do that in your dispatch-fn. You also need to listen for the popstate event to jump on back.
I couldn't think of a way to allow the browser to do its thing with the fragment without getting stuck in an infinite loop of navigation. I don't have a lot of experience with client side javascript, so it could very well be something obvious I'm missing. If you have an idea, I'd be happy to hear it.
Previously the URL fragment wasn't being set as part of the token, so links such as
<a href="#section-1">link</a>
would get completely ignored.Similarly if there was a fragment, it would be stripped out on navigating back since the tokens in the stack didn't know about it.
I'm not sure if this was intentional, or just a vestige of using the hash for history in old browsers, but pushy is configured not to use the fragment so I can't see a reason not to use it as it was originally intended. In any event it's been useful for me.
Note that the
preventDefault
on L133 prevents the browser from jumping to the corresponding DOM element when there's a fragment, but it's simple enough to do that in yourdispatch-fn
. You also need to listen for thepopstate
event to jump on back.I couldn't think of a way to allow the browser to do its thing with the fragment without getting stuck in an infinite loop of navigation. I don't have a lot of experience with client side javascript, so it could very well be something obvious I'm missing. If you have an idea, I'd be happy to hear it.