-
Notifications
You must be signed in to change notification settings - Fork 3
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
Handling link clicks to the current URL? #8
Comments
Sounds like it's a question of what meaning can we give to an anchor link to the page your are already on? Is it always a no-op, or same as clicking on that link from elsewhere (some sort of idempotentncy)? Having thought about it whole of 5 minutes, the 2nd one sounds more appealing... In your situation, closing the side menu is equivalent to reseting the temporary state that only lives between navigations. As a workaround, is the Line 123 in 0f5da40
|
Thanks, I'll take a look at how we might use I did some investigation on this. Normal websites (that aren't using HTML5 History) treat a click on a link to the current page as a full page reload, but don't add a new entry to the browser history (I checked Safari, Chrome, and Firefox). I think your second option sounds like it would do the same thing, and would fit the user and programmers mental model of what should happen on a link click to the same page. |
Do you know what accountant does, by any chance? |
Unsure, I'll have to check. |
I am having the exact same question. @danielcompton, did you find any elegant solution? |
I don't remember if I did, but I suspect not. |
We have a hamburger menu which takes over the whole page on mobile. Each of the links in the menu is just a regular
<a>
with a path another route. When the user clicks on a link to a page they're not currently on, ourdispatch-fn
is called and we navigate to the page we want to show.The problem we're having is that if they click a menu link to a page that they're already on, the history update is short circuited. This prevents the NAVIGATE event from firing, so we never get a chance to act on the click in our normal route handling code. This means we never get an event to hide the menu.
I can see a few ways we can fix this on our side:
I'm not sure if we just have a bad architecture here and should be structuring our code a bit differently. OTOH, it does seem like apps might want to be able to respond to link clicks to the page they're already on?
What do you think? Is this something that would make sense for pushy, or does it mix concerns badly?
The text was updated successfully, but these errors were encountered: