Page MenuHomePhabricator

Desktop link inspector popups flickers several times before it closes
Open, Needs TriagePublic

Description

Desktop link inspector popups flickers several times before it closes.

I'm splitting off this problem from T229900, original description:

Now there are two scenarios with using Add a Link, one is that one of the link suggestions is the one you want. In that case, I click on the link and then the the pop-up does another quick shake (it feels like it is moving left and right or maybe flickering) and then the pop-up disappears and the link appears in the text window. It all happens quite quickly so it's over before you can really focus on what the movement is, but it's noticeable and a little annoying.

I can reproduce the problems, and I recorded videos of them:

Here are still frames from the video, where you can see the inspector popup go through 4 stages before it closes (!):

Initial frame when clicking on a linkPage title filled inAction buttons disappearSuggestions disappearEverything disappearsInspector closes
147.png (1×1 px, 515 KB)
150.png (1×1 px, 517 KB)
155.png (1×1 px, 515 KB)
157.png (1×1 px, 440 KB)
159.png (1×1 px, 450 KB)
160.png (1×1 px, 478 KB)

Event Timeline

I think most of this problem occurs because ve.ui.LinearContext.prototype.onInspectorOpening does things in the wrong order – it hides the window at the teardown stage rather than the hold stage (https://www.mediawiki.org/wiki/OOUI/Windows#Window_lifecycle). However that code is pretty difficult to reason about because it uses the nested promises for window lifecycle (opening/closing).

I think the first thing we should do here is refactor that to use the WindowInstance object (this.inspectors.lifecycle). The nested promises are already soft-deprecated in OOUI (they don't emit warnings but there are sad comments in the source like "Deprecated placeholder promise given to compatOpening in openWindow() that is resolved in closeWindow().")