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):

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)

Details

Related Gerrit Patches:
mediawiki/extensions/WikibaseMediaInfo : masterFix 'Discard Changes' and 'Leave Site' alerts
mediawiki/extensions/WikibaseMediaInfo : masterAdd close confirm alert when canceling un-saved SDC content

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 25 2019, 6:20 PM
Ramsey-WMF triaged this task as Normal priority.Mar 25 2019, 6:21 PM
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:

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.

Done! thanks

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 added a subscriber: Jdforrester-WMF.

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:

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

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

Cparle added a subscriber: Cparle.Apr 18 2019, 1:17 PM

ok on test-commons

Ramsey-WMF closed this task as Resolved.Apr 23 2019, 11:53 PM

Verified on production, logged in and out.