Page MenuHomePhabricator

VisualEditor `create`/`edit` link is irregular font-size when collapsed at lower resolutions
Closed, ResolvedPublicBUG REPORT

Description

For some reason the VisualEditor create link is rendering without the span that is meant to wrap the label.

QA steps

  • Load a page that doesn't exist with VisualEditor enabled
  • Shrink the page so that the "create" link collapses into the more menu

Expected: The edit link font-size matches the other links
Actual:

Screen Shot 2021-09-29 at 2.22.46 PM.png (498×1 px, 109 KB)

Developer notes

The HTML generated looks like:

<li id="ca-ve-edit" class="mw-list-item collapsible" style="display: block;"><a href="/w/index.php?title=Supporting_Indian_Language_Wikipedias_Program/Support/sulthan90&amp;veaction=edit" title="Edit this page [⌃⌥v]" accesskey="v">
Edit
</a></li>

but it should be

<li id="ca-ve-edit" class="mw-list-item collapsible" style="display: block;"><a href="/w/index.php?title=Supporting_Indian_Language_Wikipedias_Program/Support/sulthan90&amp;veaction=edit" title="Edit this page [⌃⌥v]" accesskey="v">
<span>Edit</span>
</a></li>

For comparison the edit source link looks fine:

<li id="ca-edit" class="collapsible mw-list-item"><a href="/w/index.php?title=Learning_and_Evaluation/Evaluation_reports/2015/Writing_Contests/Limitations&amp;action=edit" title="Edit this page [⌃⌥e]" accesskey="e"><span>Edit source</span></a></li>

Note the span is added inside Skin::makeLink when $options['text-wrapper'] is set.
I'm not sure why this is not triggering for this particular link.

Could be an issue in VisualEditor or the core Skin code.

Event Timeline

matmarex subscribed.

We don't do anything special for Vector. The link is added in the 'SkinTemplateNavigation' hook handler: https://github.com/wikimedia/mediawiki-extensions-VisualEditor/blob/master/includes/VisualEditorHooks.php#L516. This code has worked fine for years, so I suspect a bug in core or in Vector.

I debugged this some more and this is only a problem with JavaScript enabled. The problem disappears when I remove the ext.visualEditor.desktopArticleTarget.init module so this is definitely originating in VisualEditor.

Some code in VisualEditor's ext.visualEditor.desktopArticleTarget.init module is making assumptions about how menu items in Vector are structured and appears to be rewritting the DOM.

This code has worked fine for years, so I suspect a bug in core or in Vector.

The problem is Vector's HTML has changed and some code in VisualEditor is making assumptions about how menu items in Vector are structured.

I think the issue is this line:
https://github.com/wikimedia/mediawiki-extensions-VisualEditor/blob/master/modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js#L701
which rewrites all children.

Given portlet links can have children (via text-wrapper option in core Skin) this code is not future proof. It should check to see if there's a child for broadest skin support. We could also add a method in core to accompany addPortletLink to modifyPortletLink since mediawiki.util module knows how these items are structured.

ppelberg subscribed.

This task existing within the Planned future work column on the Web-Team-Backlog board leads me to think the Web Team will be working on this task.

As such, I'm removing this from the Editing Team's current workboard.

@ppelberg this definitely looks something that should be on the editing team workboard (T292125#7391695). I'm not sure why this is in the readers web backlog at all to be honest. We'll have to ask Olga when she's back. It's possible "PLanned future work" means planned by somebody other than web (which would be confusing).

Change 963423 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] DesktopArticleTarget.init: Remove code for updating edit links

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

Change 963423 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] DesktopArticleTarget.init: Remove code for updating edit links

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

Change 995231 had a related patch set uploaded (by Sophivorus; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@REL1_39] DesktopArticleTarget.init: Remove code for updating edit links

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

Change 995231 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@REL1_39] DesktopArticleTarget.init: Remove code for updating edit links

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