Page MenuHomePhabricator

Undo doesn't work, if you switch to the visual mode
Open, Needs TriagePublic

Description

Seen at enwiki:

  1. Find an edit you don't like.
  2. Click the undo button. You'll (probably) end up in the 2010 WikiEditor. Do NOT make any changes in the wikitext mode.
  3. Switch to the visual editor.
  4. Make another change. (If you don't, then the 'Publish changes' button will be grayed out.)
  5. Save changes. Note, with satisfaction, that the complicated default edit summary has been preserved.
  6. Discover that the reversion didn't happen. Everything that you wanted to revert is still on the page.

If you've gone through the above steps, an additional problem is that the next time you click on an undo link on the revision history page, you will default to VisualEditor. If you then switch back to Source editing, you're redirected to wiki/Main_Page?action=edit&veswitched=1&oldid=24 instead of w/index.php?title=Main_Page&action=edit&undoafter=23&undo=24 (the undo and undoafter params are lost), so you're editing the page rather than undoing a specific edit.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 22 2018, 10:53 PM
kostajh updated the task description. (Show Details)Jun 20 2018, 2:42 PM
kostajh added a comment.EditedJun 20 2018, 2:47 PM

@Whatamidoing-WMF I have been looking into this while working on T185548: Undo notification is not sent if the editor switches to the visual editor. I've updated the description of this task with an additional observation. If the user switches to Visual editing, is the intention that the user should still see the "The edit can be undone" text as well as the diff? If so, we might want to add that to the scope of this task or create a new one. Currently when you switch to VE, that information disappears.

Default source editing mode:

After switching to VE, the diff and contextual information is gone:

My assumption is that if you've defaulted to Visual editing, or if you switch from Source editing to Visual editing, you should see the Visual editing diff overlay rather than the "Source editing" style of presentation for the diff.

Pols12 added a subscriber: Pols12.Oct 5 2019, 10:07 PM
JTannerWMF moved this task from To Triage to FY 19-20 on the VisualEditor board.Oct 10 2019, 3:55 PM
JTannerWMF added a subscriber: JTannerWMF.

We will work on this task sometime this year.

To fix the original problem described in this task (losing the changed wikitext), I think we only need to make the modified = … variable in init.activateVe() here: https://github.com/wikimedia/mediawiki-extensions-VisualEditor/blob/2c243647d3258bdf7df9e20a59e0361146c92b7f/modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js#L876 also consider the page to be modified if undo/undoafter parameters are provided, and therefore preserve the contents of the edit field when switching.

That probably will not fix T185548 though. In general VE doesn't support the undo workflow (right now, even if VE or WTE is your default editor, attempting to undo will always open the old wikitext editor).

I'm not sure if we want to consider the other problems mentioned by Kosta right now (we'd basically need to add proper undo support).

But If VE were to support the entire undo workflow… I guess this would mean generating the edit summary, opening the diff window immediately upon loading the editor, and passing some extra parameters when saving (or switching editors) to tag the edit as an undo.

If the user switches to Visual editing, is the intention that the user should still see the "The edit can be undone" text as well as the diff? If so, we might want to add that to the scope of this task or create a new one. Currently when you switch to VE, that information disappears.
(…)
After switching to VE, the diff and contextual information is gone:

I don't think this should be still shown after switching editors. It should be shown on the initial view (assuming we add undo support to VE), but it should disappear after switching editors. I think switching editors is somewhat similar to previewing an edit, and previewing in old wikitext editor hides this notice.