Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[system] maxWidth prop does not respect rem breakpoints #38594

Closed
2 tasks done
fymmot opened this issue Aug 22, 2023 · 1 comment 路 Fixed by #38633
Closed
2 tasks done

[system] maxWidth prop does not respect rem breakpoints #38594

fymmot opened this issue Aug 22, 2023 · 1 comment 路 Fixed by #38633
Assignees
Labels
bug 馃悰 Something doesn't work package: system Specific to @mui/system

Comments

@fymmot
Copy link

fymmot commented Aug 22, 2023

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 馃暪

Link to live example: https://codesandbox.io/s/pedantic-currying-28qrhq?file=/Demo.tsx

Steps:

  1. Create a theme with custom breakpoints, and set the breakpoint unit to "rem" . Define the sm breakpoint as 22.5.
  2. With the new theme, use the maxWidth prop with value "sm" on any component that support it, e.g. Typography or Box
  3. Examine the end result and the rendered styles.

Current behavior 馃槸

The max-width style is rendered incorrectly with hardcoded px width instead of rem.

E.g. max-width: 22.5px

image

Expected behavior 馃

The max-width style should use the actual rem value from the theme:

E.g. max-width: 22.5rem

Context 馃敠

We are trying to convert our MUI-based component library to rem breakpoints so that our components can better support text scaling (required for accessibility compliance and for good UX).

However, this issue is stopping us from being able to go through with the change since the maxWidth prop is used quite extensively by our component consumers.

Your environment 馃寧

npx @mui/envinfo
  Tested latest version via CodeSandBox using Chrome and Safari.
@fymmot fymmot added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 22, 2023
@mj12albert mj12albert added the package: system Specific to @mui/system label Aug 22, 2023
@mj12albert
Copy link
Member

Thanks for reporting this and for the repro, it looks like custom breakpoint units are not accounted for in the sizing util here

@mj12albert mj12albert removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 22, 2023
@mj12albert mj12albert changed the title maxWidth prop does not respect rem breakpoints [system] maxWidth prop does not respect rem breakpoints Aug 22, 2023
@mj12albert mj12albert self-assigned this Aug 22, 2023
@mj12albert mj12albert added the bug 馃悰 Something doesn't work label Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 馃悰 Something doesn't work package: system Specific to @mui/system
Projects
None yet
2 participants