[Dialog] Form + scroll in DialogContent
See original GitHub issue- This is not a v0.x issue.
- I have searched the issues of this repository and believe that this is not a duplicate.
I know this has been discussed in #12126, but there is still an issue with the scrolling, the title and the actions aren’t fixed and they scroll
Here is the codesandbox: https://codesandbox.io/s/qlo16r5v59
Here is the code
<Dialog open aria-labelledby="form-dialog-title">
<form
onSubmit={e => {
alert("form submit!");
e.preventDefault();
}}
>
<DialogTitle id="form-dialog-title">Log in</DialogTitle>
<DialogContent>
<DialogContentText>
Please enter your account number and password.
</DialogContentText>
<TextField
autoFocus
margin="dense"
label="Account Number"
type="text"
fullWidth
/>
<TextField
margin="dense"
label="Password"
type="password"
fullWidth
/>
<div style={{ height: 1000 }} />
</DialogContent>
<DialogActions>
<Button onClick={() => alert("cancel")} color="primary">
Cancel
</Button>
<Button
type="submit"
onClick={() => alert("login")}
color="primary"
variant="contained"
>
Log in
</Button>
</DialogActions>
</form>
</Dialog>
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:27 (11 by maintainers)
Top Results From Across the Web
mui/material-ui - [Dialog] Form + scroll in DialogContent - GitHub
This allows the inner flex element of Dialog to still be the operator of the flex-box container rules, and allows the children DialogTitle...
Read more >Simple Material UI dialog example has unwanted scrollbar
UPDATE: DialogContent seems to be the culprit here, we can simply try replacing <DialogContent/> with a <div/> given below
Read more >Scrolling dialog content | React Material-UI Cookbook
It can be hard to find enough vertical space to fit all of your content into a dialog. When the dialog runs out...
Read more >Dialog with header, scrollable content and actions - StackBlitz
can be found in the LICENSE file at http:/ /angular.io/license -->.
Read more >React Dialog component - Material UI - MUI
Form dialogs allow users to fill out form fields within a dialog. ... scroll=paper the content of the dialog scrolls within the paper...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hayatae Interesting, you need to apply this CSS
on the
<form>
element if you want to the dialog content to scroll instead of the dialog paper.Alternatively, you can make the paper to host your form:
+1 We face the same issue. I will implement that ugly fix for now.
But it would be nice to fix MUI at the source and allow <Dialog*> elements to be wrapped in a form without affecting layout/scrolling functionality.