Skip to content
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

[Feature request] Allow browser back button to reverse state changes #1393

Open
corneliusroemer opened this issue Sep 16, 2021 · 4 comments · May be fixed by #1403
Open

[Feature request] Allow browser back button to reverse state changes #1393

corneliusroemer opened this issue Sep 16, 2021 · 4 comments · May be fixed by #1403

Comments

@corneliusroemer
Copy link
Member

@trvb wrote in #1348:

I'd think the best solution here would be to properly work with the browser back/forward buttons and have this be a feature for generic app state. Ie you change state of Auspice to zoom tree, or filter or whatever and can easily get back to previous state by clicking back button. I think this would be much more intuitive than trying to add a universal back button to the app somewhere.

I think this is a great idea that would make navigating around Auspice even more fun and less frustrating when you're zooming around. @joverlee521 suggested I open a new issue to keep track of this feature request.

@jameshadfield
Copy link
Member

This is indeed possible, and actually implemented for some parts of auspice (e.g. change datasets). The code is here so it would be a matter of updating the relevant (redux) actions to set pushState: true. This should be on a case-by-case basis - e.g. if you slide the date slider, it'll result in many actions dispatched, and I don't think we want all of those in history.

@corneliusroemer
Copy link
Member Author

I'd like to reiterate my interest in this feature, been browsing a lot of trees lately and something in between 5 times zooming out of a branch and reset zoom and clicking into a branch is sorely missing!

@jameshadfield
Copy link
Member

I've implemented something along these lines in PR #1403. I'll revisit this again this week and see if it's OK for release. From your comment above it seems like the previous phylogenetic zoom level is what you want to "go back" to, in which case a back button on the tree (or similar) is the best solution.

My thoughts on the browser back button, or why we shouldn't use it. We can use this to revert the most recent user action, but we shouldn't. The general best practice seems to be that navigating to a materially different page should add an entry to the history stack (allowing the back button to go back to the previous page). Auspice does this when you change datasets, for instance. If we change this so that every action -- zooming the tree, zooming the map, animating, filtering -- adds an entry to the browser history, then you quickly loose the ability to go back to a page pre-auspice, and you also may not be able to go back to your previous tree zoom quickly either. (Not to mention that we'd have to change how we store state in the URL.) There are sites around the internet that do this, and I find them generally frustrating to use.

@corneliusroemer
Copy link
Member Author

Ah yes, I mixed up the browser back button and PR #1403. Looking forward to that being testable!

@jameshadfield jameshadfield linked a pull request Nov 1, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants