Page MenuHomePhabricator

Show "changes you made may not be saved" alert for structured data fields
Closed, ResolvedPublic

Description

User story: N/A

We have this:

When users start typing in one of the structured data fields (currently only captions or depicts), and attempt to leave the page either via link, browser navigation, etc, there is no warning about losing their work. We do show that warning for wikitext fields.

We want this:

Show the standard existing warning for Structured data fields too.

Screenshots (if possible):

alert.png (308×848 px, 71 KB)

Acceptance Criteria:

  • If the user makes changes in ANY structured data field (captions, depicts, or any of the fields upcoming) and they don't publish those changes before taking an action that would take them away from the page, our existing warning alert is shown (see screenshot above)

Event Timeline

Ramsey-WMF changed the subtype of this task from "Bug Report" to "Task".
Ramsey-WMF moved this task from Untriaged to Next up on the Multimedia board.
Ramsey-WMF moved this task from To Do to Doing on the Structured-Data-Team-Current-Work board.
Ramsey-WMF added a subscriber: PDrouin-WMF.

So that warning is the browser default when you unload a window - actual implementation will just use a simple alert. We aren't navigating away from the main file page (which is why that other alert rightly does not trigger), we are discarding changes to form inputs and re-rendering dynamically in place.

This is what we are looking at- a regular js alert:

Screen Shot 2019-03-25 at 5.04.13 PM.png (81×436 px, 9 KB)

Message seems a bit off- imo " Discard Changes?" is more clear.

Change 499004 had a related patch set uploaded (by Ha78na; owner: Ha78na):
[mediawiki/extensions/WikibaseMediaInfo@master] Add close confirm alert when canceling un-saved SDC content

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

gonna ping @PDrouin-WMF for opinion on whether the wording for our stuff needs to be different than it is for wikitext.

I agree with @Ha78na - "Discard changes?" is more clear.

Change 499004 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Add close confirm alert when canceling un-saved SDC content

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

Jdforrester-WMF subscribed.

Yup, working as expected (uses the browser native control, we can't over-ride the behaviours):

Display when you click the "cancel" button; has custom text:

Screenshot 2019-03-26 at 15.19.13.png (205×498 px, 32 KB)

Display when you navigate away/try to close the window/etc.; doesn't have custom text:

image.png (186×448 px, 27 KB)

Change 501047 had a related patch set uploaded (by Ha78na; owner: Ha78na):
[mediawiki/extensions/WikibaseMediaInfo@master] Fix 'Discard Changes' and 'Leave Site' alerts

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

Change 501047 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Fix 'Discard Changes' and 'Leave Site' alerts

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

Verified on production, logged in and out.