Page MenuHomePhabricator

Invisible TemplateStyles objects in the visual editor
Open, Needs TriagePublic

Description

After implementing template styles in Шаблон:Singlechart and Шаблон:Albumchart, this appeared in the visual editor in every use of these templates:

изображение.png (985×862 px, 138 KB)

The screenshot is from this article.

Smaller test case: https://ru.wikipedia.org/wiki/%D0%A3%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA:ESanders_(WMF)/%D0%A7%D0%B5%D1%80%D0%BD%D0%BE%D0%B2%D0%B8%D0%BA

Event Timeline

matmarex subscribed.

Looks like things are leaking out of transclusions.

The cells are generated by transclusions so shouldn't be editable at all, which I think is the problem.

The <th> and adjacent <td> are correctly about-grouped together by Parsoid, but the <td> is not being picked up as part of the table cell in VE.

It looks like the problem here is that there is whitespace (a linebreak) between the two about-grouped table cells, which VE doesn't handle.

The DOM spec doesn't talk specifically about "next sibling" or "next element sibling" in reference to about-grouping: https://www.mediawiki.org/wiki/Specs/HTML/2.8.0#Template_markup

The examples use formatted HTML with whitespace, but presumably just for legibility.

Is this something we should handle, or will Parsing "fix" this?

That looks like a Parsoid bug - text nodes (whitespace included) should typically get span-wrapped so they get an about-id. There shouldn't be any discontinuity in about ids.

That looks like a Parsoid bug - text nodes (whitespace included) should typically get span-wrapped so they get an about-id. There shouldn't be any discontinuity in about ids.

	 * The only exception to this adjacency rule is IEW nodes in
	 * fosterable positions (in tables) which are not span-wrapped to
	 * prevent them from getting fostered out.

From WTUtils::getAboutSiblings()
https://github.com/wikimedia/mediawiki-services-parsoid/blob/master/src/Utils/WTUtils.php#L620-L622

This has been the case in template wrapping since 2013,
https://github.com/wikimedia/mediawiki-services-parsoid/commit/65bd7ae9811e4a4e9a4a62e0b8102e1b5a6a3b7c

However, in some circumstances, we expand the range (empty content in fosterable position),
https://github.com/wikimedia/mediawiki-services-parsoid/blob/master/src/Wt2Html/PP/Processors/DOMRangeBuilder.php#L198-L201
or move content into an element to avoid expanding the range,
https://github.com/wikimedia/mediawiki-services-parsoid/blob/master/src/Wt2Html/PP/Processors/DOMRangeBuilder.php#L236-L256
but, at quick glance, both of those only concern themselves with the start of range and not whether content in fosterable positions exist across the range.

Presumably, we want to check that, expand the range if necessary and assert that we aren't adding span wrappers in fosterable positions, rather than just omitting them,
https://github.com/wikimedia/mediawiki-services-parsoid/blob/master/src/Wt2Html/PP/Processors/DOMRangeBuilder.php#L751-L764

Change #1023552 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/services/parsoid@master] [WIP] Expand tpl range if content in fosterable position

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