Page MenuHomePhabricator

Comment nodes included in Codex build, breaking v-show on some components
Closed, ResolvedPublic

Description

All the JS builds of Codex contain calls to createCommentVNode() that correspond to <!-- HTML comments --> in the Vue templates of components. This is wasteful and increases the size of the build.

But what's worse, these comments are actually created in the DOM when a Codex component is mounted, and can cause problems. For example, the ProgressBar component starts with a comment node, and this breaks v-show and probably other things that interact with the root node of the component. For example, <cdx-progress-bar v-show="false" /> still displays a progress bar(*), because v-show tries to set display: none; on the first root node, but that node is a comment, so it has no effect.

This is probably a bug in Vue, Vite, or one of the other build tools we use.

Originally reported by @Lofhi here.

(*) This behavior only appears when using Codex as an external library. It doesn't appear in the Vitepress docs site, but it does appear in the sandbox.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

This appears to have happened between Codex v1.0.1 and v1.1.1, see this diff:

image.png (107×1 px, 118 KB)

That's also when we upgraded Vue to 3.3.9.

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

[design/codex@main] build: Remove `<!-- comments -->` from build output

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

Change 988079 merged by jenkins-bot:

[design/codex@main] build: Remove `<!-- comments -->` from build output

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

Change 989250 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/core@master] Update Codex from v1.2.0 to v1.2.1

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

Change 989250 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v1.2.0 to v1.2.1

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