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

[Dialog] TextField label gets cut off when placed within a DialogContent component #31185

Closed
2 tasks done
jim-moody opened this issue Feb 23, 2022 · 6 comments
Closed
2 tasks done
Labels
bug 🐛 Something doesn't work component: dialog This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists

Comments

@jim-moody
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

If you put a TextField at the top of a DialogContent, the label gets cut off when typing in the field.
Screen Shot 2022-02-23 at 10 01 24 AM

Expected behavior 🤔

Seems like maybe there should always be some padding at the top of DialogContent or some kind of form wrapper that adds padding

Steps to reproduce 🕹

https://codesandbox.io/s/little-bush-rt0zuy?file=/src/Demo.tsx

Context 🔦

N/A

Your environment 🌎

N/A

@jim-moody jim-moody added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 23, 2022
@danilo-leal danilo-leal changed the title TextField label gets cut off when placed within a DialogContent component [Dialog] TextField label gets cut off when placed within a DialogContent component Feb 28, 2022
@danilo-leal danilo-leal 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 and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer component: text field This is the name of the generic UI component, not the React module! labels Feb 28, 2022
@abhinav-22-tech
Copy link
Contributor

Similar kind of issue: #29892

@supervanya
Copy link

If anyone is having the same issue and want a quick fix in the meantime, we did a DialogContents theme override by adding padding on top:

// theme.ts
const theme = createTheme({
  components: {
    // todo: remove once the issue is addressed: https://github.com/mui/material-ui/issues/31185
    MuiDialogContent: {
      styleOverrides: { root: { paddingTop: `${defaultSpacing}px !important` } },
    },
  },
});

@ZeeshanTamboli
Copy link
Member

ZeeshanTamboli commented Sep 12, 2022

Also can be solved by adding margin="dense": #29892 (comment).

Duplicate of #29892 which will be considered or fixed in v6.

@ZeeshanTamboli ZeeshanTamboli added the duplicate This issue or pull request already exists label Sep 12, 2022
@vishcomestrue
Copy link

Also can be solved by adding margin="dense": #29892 (comment).

Duplicate of #29892 which will be considered or fixed in v6.

This is not working for me. Mine still gets cuts off. I have tried all three margin values: "none", "normal", "dense".

@willzittlau
Copy link

Ditto. margin="dense" solved it for me

@kalanakodez
Copy link

kalanakodez commented Jun 7, 2024

This incident happened due to the overflow inside <DialogContent>. If you have overflow included in the Textfield wrapper (In Your case <DialogContent> ) or Textfield itself then the label is always cut-off. See the example below

<Dialog open>
  <DialogTitle>Some title</DialogTitle>
  <DialogContent sx={{ overflow: "initial" }}>
      <TextField label="Some label" />
  </DialogContent>
</Dialog>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: dialog This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

8 participants