Page MenuHomePhabricator

Abandon changes dialog is inconsistently shown after switching editors on mobile
Closed, ResolvedPublic

Description

Abandon changes dialog is inconsistently shown after switching editors on mobile.

The dialog should always be shown upon closing the editor if the user has made changes to the text after opening the editor, and it works fine when not switching editors:

  • open WTE, make changes, quit - OK
  • open VE, make changes, quit - OK

But if you switch between editors, it usually is not shown, even though it should be:

  • open WTE, make changes, switch to VE, quit - OK
  • open WTE, switch to VE, make changes, quit - NO WARNING
  • open VE, make changes, switch to WTE, quit - NO WARNING
  • open VE, switch to WTE, make changes, quit - NO WARNING

For completeness, also testing the case where changes are made in both editors before closing:

  • open WTE, make changes, switch to VE, make changes, quit - OK
  • open VE, make changes, switch to WTE, make changes, quit - NO WARNING

(I tested the above by quitting the editor using the browser back button. We should also verify that the behavior is the same when using the in-editor "close" button, or when closing the browser tab.)

Event Timeline

matmarex created this task.May 1 2019, 10:26 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 1 2019, 10:26 PM

open WTE, switch to VE, make changes, quit - NO WARNING

I get a warning for this case

Esanders added a comment.EditedMay 27 2019, 1:02 PM

This is caused by the original options object getting passed between the editors (which isn't a good idea, and has caused lots of problems). The options object also has an 'onBeforeExit' argument which is why the wrong exit handler is getting called when you switch.

Esanders claimed this task.May 27 2019, 1:28 PM

Change 512678 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/MobileFrontend@master] Fix options generation when switching editor

https://gerrit.wikimedia.org/r/512678

matmarex added a comment.EditedMay 28 2019, 7:53 PM

open WTE, switch to VE, make changes, quit - NO WARNING

I get a warning for this case

I get a warning when using the "X" button on the toolbar, but not when using the browser back button. (Your patch actually fixes this, anyway.)

Change 512678 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Fix options generation when switching editor

https://gerrit.wikimedia.org/r/512678

matmarex moved this task from Incoming to In progress on the VisualEditor (Current work) board.

Tested everything again using the same method. The patch fixes all of the previous issues, but it breaks one case that worked before:

  • open WTE, make changes, switch to VE, quit - NO WARNING

This was surprising to me, so I looked at how it previously worked. And it worked completely by accident – the 'onBeforeExit' method was being accidentally passed via 'options', and as a result we were calling the SourceEditorOverlay's method rather than VisualEditorOverlay's. We actually have no code that handles this case, and we need to add it.

Change 514371 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/MobileFrontend@master] VisualEditorOverlay: Fix abandon warning when closing after switching

https://gerrit.wikimedia.org/r/514371

Change 514388 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] MobileArticleTarget: Remove duplicate way to trigger abandon warnings

https://gerrit.wikimedia.org/r/514388

Change 514390 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/MobileFrontend@master] EditorOverlayBase: Fix browser window close warning after switching

https://gerrit.wikimedia.org/r/514390

(I tested the above by quitting the editor using the browser back button. We should also verify that the behavior is the same when using the in-editor "close" button, or when closing the browser tab.)

I verified it and found a few other issues, fixed by the patches above.

Change 514371 merged by Jforrester:
[mediawiki/extensions/MobileFrontend@master] VisualEditorOverlay: Fix abandon warning when closing after switching

https://gerrit.wikimedia.org/r/514371

Change 514388 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] MobileArticleTarget: Remove duplicate way to trigger abandon warnings

https://gerrit.wikimedia.org/r/514388

Change 514390 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] EditorOverlayBase: Fix browser window close warning after switching

https://gerrit.wikimedia.org/r/514390

matmarex added a project: Skipped QA.

I've tested this extensively and I'm confident it works correctly in all cases now (see description for the 8 scenarios and 3 ways to close the editor).

JTannerWMF added subscribers: ppelberg, JTannerWMF.

@ppelberg just pending close out from you, one of our usability improvement tasks

I've tested this extensively and I'm confident it works correctly in all cases now (see description for the 8 scenarios and 3 ways to close the editor).

Confirming the abandon changes dialog appears in the 8 scenarios listed in the task description, when quitting using both the browser back button and "x" within the editing toolbar.

Btw: having these scenarios was helpful for testing – I appreciate you laying them out as clearly as you did, @matmarex.

ppelberg closed this task as Resolved.Jul 11 2019, 12:08 AM