Page MenuHomePhabricator

ImageMap-Parsoid is missing error styling
Closed, ResolvedPublic

Description

See legacy output vs Parsoid output.

Parsoid's HTML is missing the 'error' class attribute.

Event Timeline

ssastry renamed this task from ImageMap-Parsoid is missing error styling + error isn't localized properly to ImageMap-Parsoid is missing error styling .EditedAug 12 2025, 6:33 PM
ssastry updated the task description. (Show Details)

ImageMap throws an ExtensionError which is handled inside Parsoid. The class="error" which legacy implementation adds is thus lost.

Additional note. If you are signed in, and have set your interface language, Parsoid localizes the error using the interface language shown in the infobox, but legacy emits the error in the page language. I assume Parsoid's behavior is the correct behavior here.

The right behavior sounds like a performance question to me as legacy may be doing it to avoid yet another cache split for logged in users.

That is not an issue for Parsoid because we only cache canonical HTML and post-process HTML for rendering (including user preferences like interface language). So, there will not be any cache split. That said, we do plan to add a second level of caching of post-processed HTML, but even there, we may exclude transformations based on user preferences.

ImageMap throws an ExtensionError which is handled inside Parsoid. The class="error" which legacy implementation adds is thus lost.

If we're creating a unified way of handling errors with ExtensionError, maybe we should try to adopt a unified language that's recognizable across all extensions errors. Maybe that's what the class="error" is already though

Worth verifying if other extensions add class="error" to their error messages. And, if yes, this is easily resolved by adding class="error" inside Parsoid's extension handler.

So, this should be fixed in Parsoid then.

T280766 is maybe worth a knowledge refresh.

Looks like it is fine to add the .error class in Parsoid's output since they are embedded inside a parser-output container. T281228: Provide styling for parser-outputted .error class in content-parser-output (split out from T280766) provides default styling for this class.

Change #1182941 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/services/parsoid@master] WIP: ExtensionError i18n fragments get class='error'

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

Change #1182973 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/extensions/ImageMap@master] Updated html/parsoid section + temporarily disable updated tests for Parsoid

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

Change #1182973 merged by jenkins-bot:

[mediawiki/extensions/ImageMap@master] Updated html/parsoid section + temporarily disable updated tests for Parsoid

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

Change #1182941 merged by jenkins-bot:

[mediawiki/services/parsoid@master] ExtensionError i18n fragments get class='error'

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

Change #1185118 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.22.0-a20

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

Change #1185118 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.22.0-a20

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

Post deploy and purge, the font is now the same but there's still a bit of a whitespace difference because the errors class is on a paragraph in the legacy output and a span in the Parsoid, but that's probably acceptable,
https://srn.wikipedia.org/w/index.php?title=Pasuni_fu_Para&useparsoid=0
https://srn.wikipedia.org/w/index.php?title=Pasuni_fu_Para&useparsoid=1

Change #1206483 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/services/parsoid@master] ParsoidExtensionAPI: Error i18n fragments get class='error'

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

Change #1206483 merged by jenkins-bot:

[mediawiki/services/parsoid@master] ParsoidExtensionAPI: Error i18n fragments get class='error'

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

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

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.23.0-a6

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

Change #1210725 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.23.0-a6

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