You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[system] maxWidth throws or returns an invalid value when the theme has no breakpoint unit #49895
scope: systemThe system, the design tokens / styling foundations used across components. eg. @mui/system with MUIstatus: waiting for maintainerThese issues haven't been looked at yet by a maintainer.
Without a theme: TypeError: Cannot read properties of undefined (reading 'breakpoints')
With a theme whose breakpoints has no unit: { maxWidth: '900undefined' }, which is not valid CSS.
Expected behavior
{ maxWidth: 600 }, from the default breakpoints (the function already falls back to them when the theme has no value for the key)
{ maxWidth: 900 }
Context
maxWidth in packages/mui-system/src/sizing/sizing.ts reads the breakpoint value with optional chaining and falls back to the default breakpoints, so it is meant to work without a full theme. The unit check right after it doesn't:
When there is no unit, the condition is true and it reads props.theme.breakpoints.unit anyway. The rest of the system treats breakpoint values without a unit as px.
scope: systemThe system, the design tokens / styling foundations used across components. eg. @mui/system with MUIstatus: waiting for maintainerThese issues haven't been looked at yet by a maintainer.
Activity