Page MenuHomePhabricator

VisualEditor: Adding new content via an inspector (formula, gallery, hiero, etc.) and opening the save dialog results in confusion
Closed, ResolvedPublic

Description

Intention:
Add a gallery

Steps to Reproduce:

  1. Open a page in Safari.
  1. Go to Insert > Gallery
  1. Type in the name of an image and a caption. *Don't click or type anywhere else after this.*
  1. Click on the save button.
  1. Realize that the gallery dialog is still open, so cancel the save box. The dialog will close and the gallery will display.
  1. Click on the save button again.

Actual Results:
The gallery displays on screen, but is not present in Review Changes or when the page is saved.

If you click outside the gallery dialog after typing the name, or if you click the mysterious < button, then it works as expected.

Expected Results:
A button at the bottom of the gallery inserter that says "Insert this gallery now".

Reproducible: Always


Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=67049

Details

Reference
bz60837

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:53 AM
bzimport set Reference to bz60837.

Created attachment 14483
Screenshot displaying a visible gallery, and displaying the absence of the gallery in the wikitext code

Attached:

Gallery_Screen_Shot_2014-02-04_at_10.33.48_AM.png (524×1 px, 107 KB)

More Observation: This issue happens for all other inspector for example: Math,Hiero, Link inspector.

Yuck.

Clicking out of an inspector *into the surface* causes the inspector to close, applying changes.

Clicking out of an inspector *outside the surface* (such as the save dialog launcher) causes the inspector to not close; when the save dialog is closed, this also closes the inspector and "insert" the content into CE but NOT DM, causing them to get out of sync. Not good.

Actually the CE and DM aren't out of sync, but the new document isn't being passed to Parsoid.

Change 112893 had a related patch set uploaded by Esanders:
Give the document focus on save dialog open to resolve inspectors

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

  1. The document is given focus, triggering events which result in the inspectors being closed, and a transaction being created which inserts the extension node.
  2. OOUI defers the close event of the dialog by 250ms for animation purposes, after which we set up a one-time listener to surface-transact to clear the serialization cache, but the transaction has already happened.

Fix:
Give the document focus before opening the save dialog to make sure it's in a more stable state.

(In reply to comment #6)

  1. OOUI defers the close event of the dialog by 250ms for animation purposes,

after which we set up a one-time listener to surface-transact to clear the
serialization cache, but the transaction has already happened.

Is there an event / method in OOUI (closing as opposed to close, maybe?) that fires before the animation? Then we could listen to that and immediately attach the event listener.

Change 112893 merged by jenkins-bot:
Give the document focus on save dialog open to resolve inspectors

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