Page MenuHomePhabricator

Footnote weirdness after editing the title parameter
Closed, ResolvedPublic

Description

Skärmavbild 2018-10-17 kl. 22.09.31.png (598×1 px, 252 KB)

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6

Event Timeline

Tgr added a project: TemplateStyles.
Tgr subscribed.

The mechanism of this error might be similar to T206527, but it's not going to be fixed by MCS patches (only apps use that API, VisualEditor doesn't) so reopening.

It also looked like T187142: Deduplicate template styles in Parsoid which is linked in that task. Would it be fixed there?

Deduplication would only fix it for subsequent occurrences of references with <cite> elements. The first one would still have the <style> element coming shortly after the <cite> element.
Having said that, I've tried three browsers but cannot reproduce this issue.

I can reproduce this 100% with Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6 (in e.g. this edit https://en.wikipedia.org/w/index.php?title=User:Josve05a/cite-sandbox&diff=864943011&oldid=864942991; by simply pressing Edit and changing the title parameter in the cite template).

I had been hoping to find that this has been fixed by patches for TemplateStyles support a few months ago, but alas it hasn't. Instead I have reproduction steps:

  1. Follow the instructions on https://en.wikipedia.org/wiki/Category:CS1_maint:_Archived_copy_as_title to enable showing of CS1 maintenance messages:

Editors who wish to see all cs1|2 maintenance category messages can do so by updating either their common CSS page or their specific skin's CSS page (common.css and skin.css respectively) to include the following:

.citation-comment {display: inline !important;} /* show all Citation Style 1 error and maintenance messages */
  1. Visit a page that has such a maintenance message (for example, https://en.wikipedia.org/w/index.php?title=User:Josve05a/cite-sandbox&oldid=864942991) and edit it using VE
  2. Edit the citation template to resolve the problem and thus cause the maintenance message to disappear (in this example, change the "Title" parameter to something different than "Archived copy")

You end up with a bunch of CSS code being shown in place of the maintenance message, with the same styling (e.g. text color). Instead the message should just disappear.

It seems that VE copies attributes from the <span class="citation-comment" …> node (which is removed) to the <style data-mw-deduplicate="TemplateStyles:r861714446" …> node (following it), causing it to appear (it is normally invisible). I have not worked out how it happens.

I think this has something to do with ve.dm.Converter.static.renderHtmlAttributeList, and I think Ed understands that code better.

Regression was caused by moving renderHtmlAttributeList to initialize unconditionally in https://gerrit.wikimedia.org/r/#/c/VisualEditor/VisualEditor/+/195238/ (by @Catrope). I think for GeneratedContentNodes, we don't need to call renderHtmlAttributeList when updating.

Actually this isn't an issue with CE rendering. CE generated content nodes already have renderHtmlAttributes set to false. This is a DM rendering created by PreviewElement, so we need to disable preserveHtmlAttributes as well.

Change 481894 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Don't preserveHtmlAttributes on transclusion nodes

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

Change 481894 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Don't preserveHtmlAttributes on transclusion nodes

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

Change 485024 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Don't preserve all HTML attributes on transclusion nodes

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

With that patch, the issue is fixed for refs' context menus, but it is not fixed for reflists' CE renderings. We might need a similar patch in the Cite extension?

Change 485024 had a related patch set uploaded (by Bartosz Dziewoński; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Only preserve data-parsoid/RESTBase ID on transclusion nodes

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

With that patch, the issue is fixed for refs' context menus, but it is not fixed for reflists' CE renderings. We might need a similar patch in the Cite extension?

A year has passed, I re-tested this, and somehow the issue with reflists has disappeared. I guess this one will remain a mystery for the ages…

Change 485024 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Only preserve data-parsoid/RESTBase ID on transclusion nodes

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