Page MenuHomePhabricator

VisualEditor: Browser back button should work as expected
Closed, ResolvedPublic

Description

We should use pushState such that pressing the back button after clicking VisualEditor takes you back to read mode.


Version: unspecified
Severity: minor

Details

Reference
bz43844

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:35 AM
bzimport set Reference to bz43844.
Catrope created this task.Jan 11 2013, 12:19 AM

Is this an easy bug?

To further clarify what the issue here is:

  • a user visits https://www.mediawiki.org/wiki/Wikimedia_Engineering/2012-13_Goals;
  • user clicks "edit";
  • VisualEditor form loads;
  • user tries to escape the form by pressing the "back" button in his/her browser;
  • browser's "back" button doesn't work as expected (it should take the user back to the implicit view action where he/she started).

We currently use ?veaction=edit as trigger for VisualEditor from a permanent url.

This is implemented by checking the query parameter on page load and triggering init (just like a click on "VisualEditor" would do), and then we replace (without refresh) the url to drop this query parameter using the HTML5 History api (replaceState).

I'd recommend we build on this by using pushState when VisualEditor is initialised (we can then remove the current behaviour as there's no longer any reason to remove it from the url).

Note that it is slightly more complicated than just calling replaceState on init. We also need to listen on('popstate') to move back to read mode if the user presses Back to a url within the history that contains HTML5 history state data from VisualEditor.

Setting milestone to 2013-06-27 since it is marked as blocker for "Beta" (2013-07). It may be moved to an earlier milestone as we see fit. But no later than 06-27. Setting it since I use milestone to sort "My bugs".

Related URL: https://gerrit.wikimedia.org/r/67171 (Gerrit Change Ia4b949d9c066a3f7b07217aa3d51de9908734e85)

Related URL: https://gerrit.wikimedia.org/r/67172 (Gerrit Change I5c345c1526852a84b04436955845bf1b56d94402)

  • Bug 49336 has been marked as a duplicate of this bug. ***

Merged and will go out with wmf7 (from tomorrow).

This seems to be broken again (back button changes URL but doesn't take user back to read state)

Lokal_Profil: Where? Example link? Browser? Reopening not helpful without giving instructions to reproduce... :-)

(In reply to Andre Klapper from comment #10)

Lokal_Profil: Where? Example link? Browser? Reopening not helpful without
giving instructions to reproduce... :-)

Sorry ;)

Confirmed in both Firefox and Chorme running on Ubuntu

Tested on both sv.wp[1] and en.wp[2] (logged out on sv.wp to make sure no personal settings were affecting it)

[1] https://sv.wikipedia.org/wiki/Bonsai?uselang=en
[2] https://en.wikipedia.org/wiki/Bonsai

(In reply to Lokal_Profil from comment #11)

(In reply to Andre Klapper from comment #10)

Lokal_Profil: Where? Example link? Browser? Reopening not helpful without
giving instructions to reproduce... :-)

Sorry ;)
Confirmed in both Firefox and Chorme running on Ubuntu
Tested on both sv.wp[1] and en.wp[2] (logged out on sv.wp to make sure no
personal settings were affecting it)
[1] https://sv.wikipedia.org/wiki/Bonsai?uselang=en
[2] https://en.wikipedia.org/wiki/Bonsai

Moved to bug 63739 as a new regression.