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

[TextField] Clipped label when used as first child in DialogContent #29892

Open
2 tasks done
reckter opened this issue Nov 25, 2021 · 4 comments
Open
2 tasks done

[TextField] Clipped label when used as first child in DialogContent #29892

reckter opened this issue Nov 25, 2021 · 4 comments
Labels
component: dialog This is the name of the generic UI component, not the React module! component: text field This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material

Comments

@reckter
Copy link
Contributor

reckter commented Nov 25, 2021

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

When using a TextField as the first child in a DialogContent, the top part of the label is clipped and not readable.

image

Expected behavior 🤔

It shouldn't be clipped, and instead be visible.

Steps to reproduce 🕹

Simple demo here: https://codesandbox.io/s/still-surf-tweos

      <Dialog open>
        <DialogTitle>Title</DialogTitle>
        <DialogContent>
          <TextField value="test" label="Label" />
        </DialogContent>
      </Dialog>

Context 🔦

No response

Your environment 🌎

`npx @mui/envinfo`
The sandbox uses 5.2.0
Browser that I tested: chrome and safari, both have the issue
@reckter reckter added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 25, 2021
@reckter
Copy link
Contributor Author

reckter commented Nov 25, 2021

Our current workaround is

const theme = useTheme
//....

<DialogContent sx={{ pt: `${theme.spacing(2)} !important` }}>

Which feels very clunky, as the !important is necessary, because there is a rule than overrides the padding-top, which is more precise than the rule the sx prop generrates.

@abhinav-22-tech
Copy link
Contributor

Check out this: https://codesandbox.io/s/competent-brown-28n7c?file=/src/Demo.tsx

<DialogContent>
        <TextField value="test" label="Label" margin="dense" />
</DialogContent>

After applying margin=" dense" it works fine. It will adjust the vertical spacing.

@hbjORbj hbjORbj added component: dialog This is the name of the generic UI component, not the React module! component: text field This is the name of the generic UI component, not the React module! bug 🐛 Something doesn't work package: material-ui Specific to @mui/material and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 26, 2021
@mbrookes mbrookes changed the title TextFields as filst Child in DialogContent, have a clipped label [TextField] Clipped label when used as first child in DialogContent Nov 28, 2021
@siriwatknp siriwatknp removed the bug 🐛 Something doesn't work label Mar 3, 2022
@siriwatknp siriwatknp added this to the v6 milestone Mar 3, 2022
@supervanya
Copy link

Our current workaround is

const theme = useTheme
//....

<DialogContent sx={{ pt: `${theme.spacing(2)} !important` }}>

Which feels very clunky, as the !important is necessary, because there is a rule than overrides the padding-top, which is more precise than the rule the sx prop generrates.

We did a global override which works really well, see my comment here: #31185 (comment)

@sp-reach
Copy link

There is a pretty good stackblitz to reproduce the error here: Issue 40188
TLDN (too long didn't navigate)
Stackblitz Web
Stackblitz Editor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: dialog This is the name of the generic UI component, not the React module! component: text field This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material
Projects
Status: Stalled
Development

Successfully merging a pull request may close this issue.

8 participants