Page MenuHomePhabricator

Implement unsaved changes warning message
Closed, ResolvedPublic5 Estimated Story Points

Description

Split out from umbrella ticket T260765: VE Dialog on the Test Instance: Redesign top of dialog
Dependent on T260885: Implement back button and dialog heading change

Requirements

  • Add warning about data loss when clicking the back button after having added data.
  • Title:"Remove template?" Error message:"Going back will remove this template and any data you have input. You can then choose a different template. This action is not reversible."
  • Button options: "Cancel" and "Remove template."
  • When no data has been entered, show no warning.

Mocks

Warning (with .9 opacity white overlay):

Back to search warning.png (642×701 px, 44 KB)
Back to search warning specs.png (642×701 px, 51 KB)

Event Timeline

Lena_WMDE set the point value for this task to 2.
Lena_WMDE renamed this task from Draft - implement unsaved changes warning message to Implement unsaved changes warning message.Aug 24 2020, 8:54 AM
Lena_WMDE updated the task description. (Show Details)

Change 624780 had a related patch set uploaded (by Andrew-WMDE; owner: Andrew-WMDE):
[mediawiki/extensions/VisualEditor@master] [POC][WIP] Implement back button warning popup

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

@Andrew-WMDE Just tried out the back button on the test instance! Generally it looks and is working great.

One detail I noticed though, this warning message should only show if any data has been added to the template. If it's still empty, then there is no need for a warning and it can just reset/ go back to the search.

@Andrew-WMDE Just tried out the back button on the test instance! Generally it looks and is working great.

Great!

One detail I noticed though, this warning message should only show if any data has been added to the template. If it's still empty, then there is no need for a warning and it can just reset/ go back to the search.

Just added this functionality and it should be testable on the test instance.

Lena_WMDE changed the point value for this task from 2 to 5.
Lena_WMDE moved this task from Demo to Done on the WMDE-QWERTY-Sprint-2020-08-26 board.

Note for @ECohen_WMDE: I realized there is already a design for an error state within a dialog. It's actually part of OOUI. A feature of the "process dialog". Unfortunately I couldn't find it on the official demo page. This is how it looks:

Screenshot from 2020-09-09 11-41-46.png (584×779 px, 64 KB)

(This example is when you try to save a page in VisualEditor, but the server is gone.)

This is how the design implemented in this patch currently looks like:

Screenshot from 2020-09-09 11-46-28.png (407×1 px, 47 KB)

It's extremely close, almost indistinguishable, which is great. \o/ There are minor differences. Margins/paddings in our design are in px, but in em in the OOUI design. The font size is the same, but the weight is not. Is it worth tweaking our design? What do you think?

@thiemowmde We quickly discussed this in the daily and it seems like a good idea to use the component if it exists, especially since we might end up adding more warnings in the end. Glad to hear there is such good consistency though! Is it possible to use the component with two buttons, one neutral and one destructive?

It's possible to have 2 buttons. One is always there and labeled "Dismiss" by default. The second button is optional and labeled "Continue" or "Try again", depending on the error.

Changing the button labels is not officially supported, but possible nevertheless.

@Andrew-WMDE: All this is part of OOUI's OO.ui.ProcessDialog. What this means is that it's hard to re-use this feature in code that is not a subclass of ProcessDialog. But as it turns out the ve.ui.MWTransclusionDialog where we need this is a ProcessDialog. \o/

Change 624780 abandoned by Awight:
[mediawiki/extensions/VisualEditor@master] [POC] Implement back button warning popup

Reason:
Moved to a gitlab branch, https://gitlab.com/wmde/mediawiki-extensions-VisualEditor/-/tree/back-button

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