Skip to content

Shared "Back" button on detail pages can navigate outside the app when the page was opened from a fresh tab or shared link #1162

@jack-stormentswe

Description

@jack-stormentswe

The shared back-navigation button used on every detail page in the app (Miner, Repository, PR, Issue, and the Search results page) decides whether to step the browser history or fall back to a known in-app route based on a single signal - whether the browser reports more than one entry in its history stack.

That signal is not a reliable indicator that the previous history entry actually belongs to the app. In several common flows the browser reports a longer history even though nothing before the current page came from inside the app:

  • The user opens a shared deep link in a new tab - the new-tab page itself counts as a history entry.
  • The user opens the page from a bookmark or by pasting a URL into the address bar.
  • The user follows an external link (from social media, chat, email, etc.) that lands directly on a detail page.

In all of these flows, clicking the "Back" button on the destination detail page takes the user out of the app - back to the new-tab page, the previous external site, or wherever the browser's previous entry pointed - instead of routing them to the sensible in-app list page (top miners, repositories, bounties, etc.) the button is supposed to be able to fall back to.

The same root-cause issue was recently addressed on the 404 page's own "Go back" button, but the broader fix needs to live in the shared back-button component so every detail page that uses it picks it up.

Expected behavior:

  • "Back" should only step the browser history when the previous history entry is verifiably an in-app page.
  • When the previous entry can't be confirmed to be in-app, the button should fall back to a known route - preferably the per-page parent route the component already accepts as a fallback (so a deep-linked miner page goes to the miners list, a deep-linked repo page goes to the repositories list, etc.), rather than dumping the user on the home page.
  • A one-click "Back" should never silently take the user out of the app.

Repro:

  1. Open a detail page directly in a fresh browser tab (e.g. paste /miners/details?githubId=… into the address bar of a brand-new tab, or click a link to it from a different site / app).
  2. Without navigating anywhere else first, click the "Back" button at the top of the page.
  3. Observe that the browser exits the app - landing on the new-tab page, the previous external site, or whatever the browser's prior history entry pointed at - instead of the sensible in-app list page.
  4. Reproduce on the other detail surfaces (/miners/repository, /miners/pr, /bounties/details, /search) by opening any of them in a new tab the same way.

How to Verify:

85.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions