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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Box] Add warning when using responsive object API if a key is not a valid breakpoint #23218

Closed
2 tasks done
mnajdova opened this issue Oct 23, 2020 · 1 comment
Closed
2 tasks done
Assignees
Labels
package: system Specific to @mui/system

Comments

@mnajdova
Copy link
Member

mnajdova commented Oct 23, 2020

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

When using the responsive object API on the Box sx prop, I have made a mistake and got the {} nesting wrong. I ended up with

<Box
  sx={{
    width: {
      xs: 100,
      color: 'red',
    }
  }}
/>

I was surprised to see the color red style applied.

Expected Behavior 🤔

The color red should not be applied. There may even be a warning that color is not a valid breakpoint. Pseudo selectors should not show the warning as any css property in that case.

First reported here #23053 (comment)

@mnajdova mnajdova added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 23, 2020
@mnajdova mnajdova self-assigned this Oct 23, 2020
@mnajdova mnajdova added package: system Specific to @mui/system and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 23, 2020
@mnajdova
Copy link
Member Author

I wouldn't like to complicate the logic too much just for adding a warning for this use-case. I'd rather wait to see if the community will ask for something like this. Will close for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: system Specific to @mui/system
Projects
None yet
Development

No branches or pull requests

1 participant