SPA and back key

Dear all,

I’m facing a little UI/UX issue with my app, made of several pages. Among these pages, a dashboard built as a SPA (several tabs, using states to display each tab group).

I am not sure I can avoid this “issue”, but when the dashboard page is displayed, if the user press the back button (from his keyboard or from the browser navbar), he leaves the dashboard page. The problem is that the users, and I, often the back key to come back to a previous page, or in the case of my keyboard, to the previous tab. And here, with such design, that does not work as the user comes back to the previous page (instead of the previous tab).

Would there be a way to “catch” the “back” event and to play with states or variables to avoid such behavior, and to be able to navigate back to previous dashboard tabs when pressing the back key?

I’m not sure… But I prefer asking!

Good day to all, and many thanks in advance for any feedback!

You could also try and write t the browser history for the last 2 pages being same as the current.

This will help you get started & the Toolbox plug-in - https://gomakethings.com/how-to-replace-the-current-url-in-the-browsers-history-with-the-vanilla-js-replacestate-method/

2 Likes

Many thanks for your feedback @it1, I’m going to give a try! Thanks!

This topic was automatically closed after 70 days. New replies are no longer allowed.