Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#26997 closed defect (bug) (fixed)

Revisions screen should use replaceState not pushState

Reported by: adamsilverstein Owned by: nacin
Priority: normal Milestone: 3.9
Component: Revisions Version: 3.9
Severity: minor Keywords: has-patch 2nd-opinion
Cc: Focuses:

Description

Since backbone changes at version 0.9 rendered revision routes inactive (see #27575) history pushState doesn't make sense because while application states are being pushed to the browser history, using the back button does not resore the state (it only changes the URL) - it looks like this currently: ​http://cl.ly/0a090R1n2D1r

At Nacin's suggestion this ticket proposes using replaceState instead, triggered by adding { replace: true } to the navigate calls. After applying the attached patch, hitting the back button takes you back to the previous page (the post editing screen typically). The browser URL is still updated while navigating revisions to reflect the current application state so hitting refresh works, and linking or bookmarking the URL also works. It looks like this: ​http://cl.ly/310Q3K0h0413

Attachments (1)

26997.diff​ (696 bytes ) - added by adamsilverstein 13 years ago.
use replaceState for revisions navigation

Download all attachments as: .zip

Change History (6)

@adamsilverstein
13 years ago

use replaceState for revisions navigation

#1 @adamsilverstein
13 years ago

  • Keywords has-patch dev-feedback added
  • Severity normal → minor

#2 @nacin
13 years ago

  • Keywords 2nd-opinion added; dev-feedback removed
  • Milestone Awaiting Review → 3.9

This would make it a lot easier to navigate back to the post you were on. (In addition to #24682). The URLs are still sharable, that's really what matters.

Gonna seek a second opinion from markjaquith but otherwise I think this is good to go.

#3 @markjaquith
13 years ago

I agree. I chose pushState intentionally, but it was based on a mistake (thinking that JS-based routing was working), and a thought I've since changed my mind about (that the gradations of history for your revisions escapades [revisions revisions?] are of interest to anyone and are worth the difficulty of getting back to the last non-revisions URL you viewed).

#4 @nacin
13 years ago

  • Owner set to nacin
  • Resolution → fixed
  • Status new → closed

In 27114:

Revisions browser: The back button should return to the post you were editing (use replaceState instead of pushState).

props adamsilverstein.
fixes #26997.

#5 @nacin
13 years ago

Yeah, it just feels like a better experience to me. The vast majority of people who click the back button want to get back to the post they were editing, not awkwardly relive every movement of their mouse.

Note: See TracTickets for help on using tickets.