Page MenuHomePhabricator

Add a link: context item is set up and torn down right after on desktop (sometimes)
Closed, ResolvedPublicBUG REPORT


Steps to Reproduce:

  1. Enable link recommendations
  2. Click on task card from Special:Homepage

Actual Results:
Link recommendation annotations are highlighted in the article, but the corresponding context item doesn't show up. This happens some of the time in Chrome and Firefox.

Expected Results:
Corresponding context item is opened and isn't torn down until the user clicks outside the context item.

Screen recording:

At 00:14, the context item can be seen briefly before it was torn down.

Screen Shot 2021-04-02 at 1.16.38 PM.png (1×2 px, 1 MB)

Logs from console:

after activate ve load.php:938:143
done setting up recommended link context item at 1617394079498 load.php:395:977
tearing down LinearContextItem at 1617394079658 load.php:787:866

Logs with stack trace:

Event Timeline

Looking further into VE's code, it looks like the surface is focused in (which then eventually calls surface.getModel().selectFirstContentOffset(); in the next run loop). This does seem explain why the context item is set up and torn down right away (when the context item is already open, focusing anywhere outside of the context item closes the currently opened context item)

done setting up RecommendedLinkContextItem at 1617401089942 load.php:395:977
ve.ce.Surface.prototype.focus 1617401090012 load.php:504:353
selectFirstContentOffset load.php:240:633
tearing down LinearContextItem at 1617401090083

When this issue occurs, the focusNode is NOT the expected annotation.

We should make sure that the annotation is selected AFTER DesktopArticleTarget focuses on the page so that the context item doesn't get closed by the subsequent focus.

Change 676686 had a related patch set uploaded (by MewOphaswongse; author: MewOphaswongse):

[mediawiki/extensions/GrowthExperiments@master] Add a link: make sure annotation is selected after page is focused

Change 676686 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Add a link: make sure annotation is selected after page is focused

Etonkovidova subscribed.

Checked in testwiki wmf.37.