Skip to content

fix: feed detail and map improved back navigation#76

Open
Alessandro100 wants to merge 7 commits intomainfrom
fix/41-feed-detail-back-button
Open

fix: feed detail and map improved back navigation#76
Alessandro100 wants to merge 7 commits intomainfrom
fix/41-feed-detail-back-button

Conversation

@Alessandro100
Copy link
Contributor

@Alessandro100 Alessandro100 commented Mar 18, 2026

closes #41

Summary:

Feed Detail and Feed Detail Map pages have improved "Back" navigation

Expected behavior:

Feed Detail Page

  • If no back history -> will leave the website
  • If has history -> go back to the previous navigation (excluding map page). (Feed search page including preserved search queries or other feed detail pages in the case of gtfs rt)

Feed Detail Map Page

  • Back button will always go to it's corresponding feed detail page

Important

Explicitly not handling the functionality of directly to feed page -> back -> goes to feeds page due to the complexities of detecting a direct navigation in SSR. It's possible but adds too much complexity for what it accomplishes

Testing tips:

Play around with standard navigation and see if you get expected behaviour. For more precise tests, refere under

GTFS

  1. From search page -> do a search query -> go to feed detail -> go to map -> back -> back -> land back at the search page with the search queries preserved

GTFS RT

  1. On the page, visit various links from the related feeds -> then user the 'back' button or browser back and you should be brought back to the original page

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with yarn test to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

@Alessandro100 Alessandro100 self-assigned this Mar 18, 2026
@Alessandro100 Alessandro100 requested a review from Copilot March 18, 2026 13:19
@vercel
Copy link

vercel bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mobilitydatabase-web Ready Ready Preview, Comment Mar 19, 2026 0:23am

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves “Back” navigation behavior on the Feed Detail and Feed Detail Map experiences to avoid exiting the app on direct entry and to make Map → Detail navigation consistent.

Changes:

  • Updated the feed detail back button logic to fall back to /feeds when there’s no safe in-app history.
  • Switched map view navigation from router.push to router.replace to avoid keeping the map page in the browser history stack.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/app/screens/Feed/components/FullMapView.tsx Uses router.replace for map “back/close” actions to prevent returning to the map via browser back.
src/app/screens/Feed/components/FeedNavigationControls.tsx Adds a handleBack helper intended to avoid navigating back out of the app on direct entry.

Applied guidance: vercel-react-best-practices (custom).


You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +21 to +29
const hasReferrer = document.referrer !== '';
const hasSameOriginReferrer =
hasReferrer && new URL(document.referrer).origin === window.location.origin;

if (!hasSameOriginReferrer) {
router.push('/feeds');
return;
}

@github-actions
Copy link

github-actions bot commented Mar 18, 2026

*Lighthouse ran on https://mobilitydatabase-h3ygqt1uo-mobility-data.vercel.app/ * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟢 99 🟢 96 🟢 100 🟢 100

*Lighthouse ran on https://mobilitydatabase-h3ygqt1uo-mobility-data.vercel.app/feeds * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 88 🟠 87 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-h3ygqt1uo-mobility-data.vercel.app/feeds/gtfs/mdb-2126 * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🔴 36 🟢 94 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-h3ygqt1uo-mobility-data.vercel.app/feeds/gtfs_rt/mdb-2585 * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 79 🟠 83 🟢 100 🟢 100

*Lighthouse ran on https://mobilitydatabase-h3ygqt1uo-mobility-data.vercel.app/feeds/gbfs/gbfs-flamingo_porirua * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 88 🟢 94 🟢 96 🟢 100

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 this pull request may close these issues.

Fix: Feed Detail Page direct navigation "Back" button bug

2 participants