Skip to content

Comments

[code-infra] Detect browser envs that don't support layout#47813

Open
Janpot wants to merge 5 commits intomui:masterfrom
Janpot:detect-layout-support
Open

[code-infra] Detect browser envs that don't support layout#47813
Janpot wants to merge 5 commits intomui:masterfrom
Janpot:detect-layout-support

Conversation

@Janpot
Copy link
Member

@Janpot Janpot commented Feb 19, 2026

fixes #47792

Auto-detect test environments that don't support browser layout and alter behavior based on that.

We want to avoid any "TEST ENV" markers for this as users tend to set them up regardless of JSDOM or real browser. This can cause branching into code paths on real browsers that are intended for JSDOM, as we have unknowingly been doing for years as per #47812

Adding back process.env.NODE_ENV === 'test' to backport to v7 as my change was a breaking one. But to be removed in v9.

Questions:

  • Should we also add a variable like globalThis.FAKE_BROWSER or something in case users override the user agent string of JSDOM? Maybe we wait for demand in v9?

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mui-bot
Copy link

mui-bot commented Feb 19, 2026

Netlify deploy preview

https://deploy-preview-47813--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 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

Generated by 🚫 dangerJS against 0013cfe

@Janpot Janpot changed the title detect test env that doesn't support layout [code-infra] Detect browser env that doesn't support layout Feb 19, 2026
@Janpot Janpot changed the title [code-infra] Detect browser env that doesn't support layout [code-infra] Detect browser envs that don't support layout Feb 19, 2026
@Janpot Janpot requested review from a team and silviuaavram February 19, 2026 16:44
@Janpot Janpot force-pushed the detect-layout-support branch from bf11b07 to 54bf4ee Compare February 20, 2026 08:46
@zannager zannager added the scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). label Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Popover anchorEl console.warn spam in jsdom in MUI 7.3.8

3 participants