[Epic] Do not "recover" edits that were intentionally abandoned (in the visual and 2017 wikitext editors)
Closed, ResolvedPublic0 Story Points

Description

Steps to reproduce:

  1. Go to https://en.wikipedia.org/wiki/Archie_Webster_House
  2. Edit the article in the 2017 wikitext editor
  3. Replace {{NRIS-only|date=December 2013}} with I'm making some changes!
  4. Click "Article" to abandon your edit
  5. Edit the article in the 2017 wikitext editor

Expected behaviour:

  • The wikitext is the latest revision, so the first line is {{NRIS-only|date=December 2013}}

Actual:

  • Your changes are "recovered", so the first line is I'm making some changes!

Notes:

  1. For clarity, I chose a specific example for my reproduction steps. You can change quite a bit and still have it be reproducible, so this also occurs if you:
    1. make any other kind of change rather than just replacing the first line (obviously)
    2. use the visual editor instead of the 2017 wikitext editor
    3. leave the article a different way, such as clicking "Random article" or clicking on a bookmark
  2. This does not occur if you click "Read" to abandon your edit. Basically, if you see the modal dialogue in the below screenshot, then your changes will definitely be abandoned.
  3. This does not occur if you close the tab you had the editor open in, and edit the same page in a new tab.

Deskana created this task.Mar 13 2018, 11:26 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 13 2018, 11:26 AM
Deskana renamed this task from Do not "recover" edits that were intentionally abandoned (`in the visual and 2017 wikitext editors) to Do not "recover" edits that were intentionally abandoned (in the visual and 2017 wikitext editors).Mar 13 2018, 11:27 AM
Deskana moved this task from To Triage to Current work on the VisualEditor board.
Deskana edited projects, added VisualEditor (Current work); removed VisualEditor.
Deskana triaged this task as High priority.

The 'Article' tab not working is T189380

leave the article a different way, such as clicking "Random article" or clicking on a bookmark

If you do this we have no chance to run JS, so might be CANTFIX in those cases.

The 'Article' tab not working is T189380

Ah, I missed that as it's not on the current work board. It's probably best to get that merged, and see what needs to happen next.

Investigating a little it appears that the onUnload event does run sometimes, although we can't guarantee it. For example in Firefox, the unload event will not fire if you close the tab, despite a system unload popup being shown.

I'm also not that keen on discarding changes based on the say so of the beforeUnload dialog as it's not obviously part of the VE experience:

  • it has system styling so is not clearly connected to MW
  • in some browsers we aren't even allowed to customise the message, so can be as vague as "Do you want to reload this site?"
  • in can be triggered by an action that is directly related to that tab, e.g. closing the whole browser; while the browser will switch to that tab before showing the message (we hope) it is again not obvious to the user they are now choosing to abandon that particular edit
DLynch added a subscriber: DLynch.Mar 13 2018, 4:59 PM

We could add some UI feedback for the "changes have been made since your autosave" case, maybe? It's sessionStorage, so there's an inherently limited time this issue can apply for.

TBolliger added a subscriber: TBolliger.
Deskana renamed this task from Do not "recover" edits that were intentionally abandoned (in the visual and 2017 wikitext editors) to [Epic] Do not "recover" edits that were intentionally abandoned (in the visual and 2017 wikitext editors).Mar 15 2018, 5:39 PM
Deskana added a project: Epic.
Deskana changed the task status from Open to Stalled.

Some of the cases where changes were being erroneously recovered were fixed, and others were not. The remaining situations need to be enumerated, and decided on a case-by-case basis. This task is essentially an epic, now.

Deskana closed this task as Resolved.
Deskana set the point value for this task to 0.
Deskana moved this task from Up next to Done on the VisualEditor (Current work) board.
Deskana claimed this task.

This epic should be resolved now.