Page MenuHomePhabricator

Charts with errors are not editable in VE
Closed, ResolvedPublic

Description

Input {{#chart:Missing}} in wikitext. In VE this no longer generates a ve.dm.ChartNode, just a regular Template parser function which can't be fixed in the editor:

image.png (176×744 px, 10 KB)

This should be resolved by using more reliable syntax as described in T393306.

Event Timeline

Jdlrobson-WMF changed the task status from Open to Stalled.May 5 2025, 1:41 PM
Jdlrobson-WMF triaged this task as Medium priority.
Jdlrobson-WMF subscribed.

Stalled on T393306.

Change #1163450 had a related patch set uploaded (by Catrope; author: Catrope):

[mediawiki/extensions/Chart@master] VisualEditor: Treat charts as block, not inline

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

Catrope moved this task from Incoming to Code Review on the Charts (Current Sprint) board.
Catrope subscribed.

This wasn't actually related to T393306. Error charts have the same RDFa type and data-mw information as regular charts. The issue was that the chart node type inherited from MWTransclusionInlineNode, but error charts are <div>s, and inline nodes can't match block elements. But this was wrong anyway, because <mw-chart> elements are styled as display: block, so we should have been using MWTransclusionBlockNode all along. Fixing this also fixed this bug.

I did try to change the error output to something like <wiki-chart data-mw-chart='{"error":true}'><div class="cdx-message--error" ....</div></wiki-chart> to make regular charts and error charts use the same tag name, but unfortunately Parsoid breaks that because it believes <wiki-chart> is an inline tag and can't contain block tags (which is inaccurate, custom elements are allowed to contain block elements).

It would be nicer for VE if we could always use the <wiki-chart> element, but unfortunately that won't be possible unless and until this Parsoid behavior is changed.

<p><wiki-chart><div>......</div></wiki-chart></p> is parsed by every browser as <p><wiki-chart></wiki-chart></p><div>......</div><p></p> so that's not a parsoid bug per se. It's one of the dangers of using custom elements, which are always parsed as inline AFAIK.

which are always parsed as inline AFAIK

If that is true that seems like a good reason to avoid them. The is attribute proposed on the other task seems like it would cause fewer parser issues.

Change #1163450 merged by jenkins-bot:

[mediawiki/extensions/Chart@master] VisualEditor: Treat charts as block, not inline

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

Fixed in 1.45.0-wmf.8; can resolve when .7 drops off production.

Should be resolved, .9 is lowest ver in production now so it should be all live.