Skip to content

Fix font not applying to chat body on claude.ai and chatgpt.com - #186

Open
AliRadmanesh wants to merge 1 commit into
mimalef70:masterfrom
AliRadmanesh:fix/inline-font-guard-custom-properties
Open

AliRadmanesh wants to merge 1 commit into
mimalef70:masterfrom
AliRadmanesh:fix/inline-font-guard-custom-properties

Conversation

@AliRadmanesh

Copy link
Copy Markdown

Problem

On claude.ai and chatgpt.com the custom font applies to the sidebar but not to the chat body text.

Root cause

Site stylesheets exclude elements/subtrees with an author-set inline font using :not([style*="font-"], [style*="font-"] *). That also matches inline CSS custom properties whose names contain font-:

  • claude.ai: the reply wrapper [data-cds="Prose"] has style="--_prose-font-body: …", so every reply paragraph is excluded and renders in anthropic-serif.
  • chatgpt.com: <html>/<body> have --font-ui-size: 16px, so everything under them is excluded (the released stylesheet; chatgpt.css on master already uses the precise form).

Fix

Replace the guard in all assets/styles/*.css with :is([style*="font-family" i], [style*="font:" i]) (same form chatgpt.css already uses), plus a unit test that forbids the broad guard, and a CHANGELOG entry.

Verification

  • pnpm check and node --import tsx --test tests/unit/*.test.ts pass (481 unit tests); the new test fails before the change.
  • Live, using the real extension's injected CSS with the corrected guard: claude.ai Persian reply text in the custom font went 1/18 → 18/18; chatgpt.com 0/204 → 204/204.

To try locally: pnpm install && pnpm debug, then load build/chrome-mv3-dev via chrome://extensions → Developer mode → Load unpacked.

🤖 Generated with Claude Code

The [style*="font-"] guard matched inline custom properties like
--font-ui-size and --_prose-font-body, so claude.ai and chatgpt.com chat
bodies were excluded from the custom font. Match only font-family/font:
declarations and add a regression test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant