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

Keep user search results (scroll position and map fitbounds) when returning from a detail page #1282

Open
dtrucs opened this issue Oct 15, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@dtrucs
Copy link
Collaborator

dtrucs commented Oct 15, 2024

When a user navigates the search page (scrolls to a particular card, zooms in on a particular location), clicks on a card and then returns to the search page, the search result is reset. It's not a great user experience.
I think the view must be the same as the one displayed before clicking on the card.

1. Activate this feature only with the history manipulation

history refers to the use of the browser's "back" or "forward" buttons.
We need to differentiate between users who want to return to the state of a search result (i.e. click on the "back" button) and those who want to see the full content of the search page (i.e. click on the "search" button).

2. Activate the scrollRestoration browser feature

The scrollRestoration is activated after the user click on the the browser's "back" or "forward" buttons: The location on the page to which the user has scrolled will be restored.

⚠️: The search page contains infinite scrolling, so it is necessary to take into account the “current” page consulted to restore scrolling at this position.
⚠️: For the moment, the search page scroll bar is defined on the list of cards, and should be moved to the body's page to process the scrollRestoration.

3. Keep the state of the map and restore it

The last step is to memorize the last user interaction with the search map (i.e saving bounds) to restore it after using history manipulation. And filter the list of card if enableSearchByMap setting is enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant