Skip to content

[docs-infra] Preserve normal body font weight - #49455

Merged
LukasTy merged 2 commits into
mui:masterfrom
LukasTy:codex/docs-font-weight
Oct 13, 2026
Merged

LukasTy merged 2 commits into
mui:masterfrom
LukasTy:codex/docs-font-weight

Conversation

@LukasTy

@LukasTy LukasTy commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

After #48842, the General Sans loader registers only weight 600 for preload. In webpack builds, Next adds that weight to its generated class, which is applied to body. This overrides the normal body weight and makes plain paragraphs, labels, and legends semibold.

The docs production build uses webpack. The default pnpm start command uses Turbopack, whose generated font class does not set this weight, so that dev server does not reproduce the regression.

Leave the General Sans class off body so these elements inherit weight 400. Next registers and preloads the font from its import, not from the class, so the font faces and preload settings do not change. Add website tests for normal body text and semibold headings. Run each test with JavaScript enabled and with JavaScript disabled. The hydrated test also checks that the General Sans 600 font face loads.

Reproduce on the deployed master Modal page. Under Nested modal, click Open modal. The paragraph with ID parent-modal-description inherits weight 600 instead of 400.

Deployed fixed docs.

The live mui.com docs update with stable releases and currently use older source, so they do not yet show this regression.

Validation:

  • Built the actual docs installation page in production mode with webpack, with the export limited to that page. Both font tests fail before the fix at body weight 600 and pass after the fix at weight 400. Each result was checked with JavaScript enabled and with JavaScript disabled.

  • Also reproduced the regression on the webpack dev server.

  • On the webpack dev server, the font tests pass in both modes, and the page preloads the same three font files as before.

  • Browser audit confirmed body weight 400, heading weight 600, unchanged font faces, and the same three preloaded font files.

  • I have followed (at least) the PR section of the contributing guide.

@code-infra-dashboard

code-infra-dashboard Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-49455--material-ui.netlify.app/
QR code for https://deploy-preview-49455--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@LukasTy LukasTy added type: regression A bug, but worse, it used to behave as expected. scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305). labels Oct 13, 2026
@LukasTy LukasTy self-assigned this Oct 13, 2026
@LukasTy
LukasTy requested a balanced review from Copilot October 13, 2026 13:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fix addresses the webpack regression and includes appropriate end-to-end coverage.

0 open findings

What changed in this PR

Preserves normal body font weight while retaining General Sans preload behavior.

Changes:

  • Applies General Sans through its CSS-variable class.
  • Adds hydrated and server-rendered font-weight regression tests.
File Description
packages-internal/​core-docs/​src/​nextFonts/​index.ts Prevents General Sans weight 600 from affecting the body.
test/​e2e-website/​docs-fonts.spec.ts Verifies body and heading weights with JavaScript enabled and disabled.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Next registers and preloads the font from its import, so the variable
class is not necessary. Check that the General Sans 600 font face loads
in the hydrated test, and use the shared test fixture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LukasTy
LukasTy marked this pull request as ready for review October 13, 2026 15:05
@LukasTy
LukasTy requested review from Janpot and brijeshb42 October 13, 2026 15:05

@brijeshb42 brijeshb42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing.

@LukasTy
LukasTy merged commit 9dfb489 into mui:master Oct 13, 2026
19 checks passed
@LukasTy
LukasTy deleted the codex/docs-font-weight branch October 13, 2026 15:22
@Janpot

Janpot commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

The docs production build uses webpack. The default pnpm start command uses Turbopack, whose generated font class does not set this weight, so that dev server does not reproduce the regression.

Is there a Next.js ticket? What is the right behavior? This solution feels like a code smell, one of the two is a bug and the one this PR chooses feels awfully unintuitive.

Also another indicator we need to think about running our screenshot regressions against the actual docs site.

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

Labels

scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305). type: regression A bug, but worse, it used to behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants