Page MenuHomePhabricator

Add unsaved changes warning message to VE TemplateDialog
Closed, ResolvedPublic1 Estimated Story Points

Description

Background:
To help users explore templates and find the right one for their intended use, we will replace the close button with a back button in the TemplateDialog once a template has been selected from search results (T272354: Add back button to VE TemplateDialog). This only applies when inserting a new template. With this ticket, we will also add a warning message that will warn users about data loss if they have entered data into a selected template.

Requirements

  • Implement behind feature flag with T272354: Add back button to VE TemplateDialog and T274263: Add button to delete template in the context menu
  • Add warning about data loss when clicking the back button after having added data.
  • Use OOUI error state component from OO.ui.ProcessDialog
  • Title:"Go back?" Error message: "Going back will remove this template along with any information you have entered, returning you to the template selection window. This action is irreversible."
  • Button options: "Cancel" (normal button) and "Remove template." (primary, destructive button)
  • When no data has been entered, show no warning.
  • Ensure it works on mobile

Mock

Back button Warning.png (642×800 px, 52 KB)

For reference, same specs as test instance (with .9 opacity white overlay), just different wording:

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

Related tickets:

Related Objects

Event Timeline

Lena_WMDE renamed this task from DRAFT: Add unsaved changes warning message to VE TemplateDialog to Add unsaved changes warning message to VE TemplateDialog.Jan 19 2021, 11:33 AM
Lena_WMDE set the point value for this task to 8.Feb 3 2021, 5:26 PM

8 story points estimate does not include feature flag (to be discussed)

Change 686608 had a related patch set uploaded (by Andrew-WMDE; author: Andrew-WMDE):

[mediawiki/extensions/VisualEditor@master] [WIP] Show a warning before resetting the transclusion dialog

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

Just noting that we won't make the same change for the trash icon button on multipart template items, since this will be removed before our feature is released. (Update: I'm not so sure about this, asking in T275761.)

Change 692304 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/VisualEditor@master] Support isEmpty on transclusion dialog elements

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

Change 692304 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Support isEmpty on transclusion dialog elements

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

@Lena_WMDE Are we going to also apply the unsaved changes warning to existing templates?

Change 686608 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Show a warning before resetting the transclusion dialog

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

@awight do you mean should the warning message appear if a user edits an existing transclusion and does not save before clicking the back button? The back button should only appear during the inserting a new template workflow, after having searched for and selected a new template and then entering data without saving. When an existing template is edited, the dialog header should not show the back button, but show a close button. This is specified here T272354: Add back button to VE TemplateDialog.

So no, this warning message will not be applied to clicking the close button when editing existing templates. If we were going to add one to that workflow, it would need a new text and button label as these would not make sense in that context.

@awight do you mean should the warning message appear if a user edits an existing transclusion and does not save before clicking the back button?

Thanks, yes this is what I mean. But as you say there will be a close button and the dialog would have to show slightly different messages.

It feels slightly inconsistent to me that we would ask for confirmation when aborting a template insert but not when editing an existing template (and then changing some values).

Is it too late to make some slight wording adjustments? When I was going through with Charlie and she made some useful suggestions that I think it makes sense to integrate. Makes it a bit clearer what each action will do.

Current title: "Go back" > Add: "Go back to search"

Error message, delete the word window since it's not a separate window: "Going back will remove this template along with any information you have entered, returning you to the template selection window. This action is irreversible."

Normal button text: "Cancel" > "Continue editing"

awight changed the point value for this task from 8 to 3.

Change 695151 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/VisualEditor@master] Improve wording around transclusion cancel

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

Lena_WMDE changed the point value for this task from 3 to 1.

Change 695151 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Improve wording around transclusion cancel

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

Lena_WMDE moved this task from Demo to Done on the WMDE-TechWish-Sprint-2021-05-26 board.

Change 719895 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/VisualEditor@master] Add tests for .containsValuableData() methods

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

Change 719895 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Add tests for .containsValuableData() methods

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