cac-tripplanner
cac-tripplanner copied to clipboard
Treat / and /explore as distinct URLs
Go to the GoPhlGo home page and hover on the "Learn" nav link. The browser status bar says gophillygo.org/learn/
. Click and you land on the Learn page, with the browser address bar reflecting that same URL (gophillygo.org/learn/
). Click browser Back and you return to the home page.
Contrast that toβ¦
Start on the home page and hover on the "Explore" nav link. The browser status bar says gophillygo.org/explore
. Click and you land in Explore mode, but the browser address bar still has the home page URL (gophillygo.org
). Click browser Back and instead of returning to the home page, you return to the page you were on prior to visiting GoPhlGo.
I think we should normalize these behaviors.
Given the single-page nature of our home and map views, I reckon there are implications I'm overlooking, but here's a strawman:
- Establish a new URL at
gophillygo.org/map
. - Whenever the app is in map view, the URL should reflect the above
/map
URL. -
gophillygo.org/explore
should redirect togophillygo.org/map
with the destination picker set to explore mode (ie, "within"). - Browser history should consider visits to
/
and/map
as distinct entries
Thanks @designmatty for bringing this up.
As long as the origin point is populated, browser history does work between the 'home' view and the 'map' or 'explore' views. The case of the origin point not being populated is a separate issue, so created #861.
The '/explore' URL works (goes to the map explore mode), by rewriting to a URL with appropriate parameters set. Losing the separate '/map' route in the URL bar was a consequence of the redesign loading the map on the home view and treating the home and map pages as restyled versions of the same page. The 'learn' page is a separate page, served statically by Django, that does not interact with the JavaScript router.
Modifications to the URL scheme would have consequences for direct linking and handling of permalinks.
I tested Back button behavior (Chrome 61/Mac) and made the following observations.
TL;DR
Without an origin, back button behaves unexpectedly in two scenarios:
- Home -> Explore -> Back
- Goes to pre-Home instead of Home.
- Home -> Explore -> More info -> Back
- Goes to Home instead of Map.
With an origin, back button behaves as expected, but the origin is lost when returning to the Home page from Explore (map), Directions (map), and More info (detail).
Observations
Without origin
Scenario: Explore
- Start on Home page.
- Click "Explore".
- Land on Map page.
- Click Back button.
- π Land on page prior to Home page.
- Expected to land on Home page.
Scenario: Directions
- Start on Home page.
- Click "Directions" on a place card.
- Land on Map page.
- Click Back button.
- π Land on Home page.
Scenario: Details
- Start on Home page.
- Click "More info" on a place card.
- Land on Detail page.
- Click Back button.
- π Land on Home page.
Scenario: Explore then Details
- Start on Home page.
- Click "Explore".
- Land on Map page.
- Click "More info" on a place card.
- Land on Detail page.
- Click Back button.
- π Land on Home page.
- Expected to land on Map page (in explore mode).
With origin
Scenario: Explore
- Start on Home page.
- Set origin.
- Click "Explore".
- Land on Map page.
- Click Back button.
- π Land on Home pageβ¦
- π but origin is lost.
- Expected to land on Home page with origin retained.
Scenario: Directions
- Start on Home page.
- Set origin.
- Click "Directions" on a place card.
- Land on Map page.
- Click Back button.
- π Land on Home pageβ¦
- π but origin is lost.
- Expected to land on Home page with origin retained.
Scenario: Details
- Start on Home page.
- Set origin.
- Click "More info" on a place card.
- Land on Detail page.
- Click Back button.
- π Land on Home pageβ¦
- π but origin is lost.
- Expected to land on Home page with origin retained.
Scenario: Explore then Details
- Start on Home page.
- Set origin.
- Click "Explore".
- Land on Map page.
- Click "More info" on a place card.
- Land on Detail page.
- Click Back button.
- π Land on map page (in explore mode)β¦
- π with origin retained.
Blocked by #1024
@lederer do you happen to know if this is still an issue? It looks to me like the routing library has been switched out since this was opened, so I'm wondering whether the behavior has changed at all as part of that work.
Still an issue. The behavior described in the original comment remains, as does that described in the TL;DR of the longer follow-up comment.