lib/src/index.css:9 sets body { font-size: var(--mt-font-size) }, but
--mt-font-size is declared only on :root:
/* lib/src/theme.css:20 */
:root {
--mt-font-size: var(--vscode-font-size);
--mt-font-family: var(--vscode-editor-font-family);
}
applyTheme() writes --vscode-font-size (default 13px) to
document.body.style (lib/src/lib/themes/apply.ts:79), not to :root.
CSS resolves var() inside a custom-property declaration at the element where
that property is declared, so the :root declaration cannot see a --vscode-*
value that only exists on body. --mt-font-size resolves to nothing,
font-size: var(--mt-font-size) is invalid-at-computed-value-time, and body
falls back to the UA default 16px instead of the intended 13px.
This is why theme.css has a second, body-scoped block — and its own comment
spells out the exact rule being violated:
/* lib/src/theme.css:95 */
* These mirror the @theme block above but are declared on `body`. CSS resolves
* var() inside a custom-property declaration at the element where the property
* is declared, so body-level declarations can see --vscode-* variables that
* applyTheme() writes to body.style. */
body {
--mt-font-family: var(--vscode-editor-font-family);
...
}
That block re-declares --mt-font-family but not --mt-font-size, which
looks like an oversight rather than intent.
Affects every host where applyTheme() is the only writer of
--vscode-font-size — standalone, website, and Pocket. VS Code is unaffected;
the webview host supplies --vscode-font-size at the document level itself.
Fix is one line — add --mt-font-size: var(--vscode-font-size); to the
body block next to --mt-font-family.
Why this wasn't fixed in the audit: it changes the inherited font size for
every unsized text node in three hosts (13px vs the 16px they render at today),
so it wants a visual review and a Chromatic pass rather than a drive-by edit.
Worth confirming the 13px intent still holds before landing it.
Found during the spec audit in #; documented rather than changed.
lib/src/index.css:9setsbody { font-size: var(--mt-font-size) }, but--mt-font-sizeis declared only on:root:applyTheme()writes--vscode-font-size(default13px) todocument.body.style(lib/src/lib/themes/apply.ts:79), not to:root.CSS resolves
var()inside a custom-property declaration at the element wherethat property is declared, so the
:rootdeclaration cannot see a--vscode-*value that only exists on
body.--mt-font-sizeresolves to nothing,font-size: var(--mt-font-size)is invalid-at-computed-value-time, andbodyfalls back to the UA default 16px instead of the intended 13px.
This is why
theme.csshas a second,body-scoped block — and its own commentspells out the exact rule being violated:
That block re-declares
--mt-font-familybut not--mt-font-size, whichlooks like an oversight rather than intent.
Affects every host where
applyTheme()is the only writer of--vscode-font-size— standalone, website, and Pocket. VS Code is unaffected;the webview host supplies
--vscode-font-sizeat the document level itself.Fix is one line — add
--mt-font-size: var(--vscode-font-size);to thebodyblock next to--mt-font-family.Why this wasn't fixed in the audit: it changes the inherited font size for
every unsized text node in three hosts (13px vs the 16px they render at today),
so it wants a visual review and a Chromatic pass rather than a drive-by edit.
Worth confirming the 13px intent still holds before landing it.
Found during the spec audit in #; documented rather than changed.