-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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] Form + scroll in DialogContent #13253
Comments
Should this demo https://material-ui.com/demos/dialogs/#confirmation-dialogs uses a form? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
+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. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@hayatae Interesting, you need to apply this CSS <Dialog>
<form
onSubmit={(event) => {
alert('form submit!');
event.preventDefault();
}}
style={{
overflowY: 'auto',
display: 'flex',
flexDirection: 'column',
}}
>
<DialogTitle on the Alternatively, you can make the paper to host your form: <Dialog
PaperProps={{
component: 'form',
onSubmit: (event) => {
alert('form submit!');
event.preventDefault();
}
}}
>
<DialogTitle For modern browser, we can use display: contents: #13253 (comment) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@oliviertassinari I definitely like the second solution, as one doesn't have to repeat existing CSS. The problem though is that (in the TypeScript definitions) PaperProps does not support form specific attributes like |
@DASPRiD noValidate should be supported. Looks like an issue. |
@oliviertassinari I think the problem is here: https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Paper/Paper.d.ts#L5 It's using |
This comment has been minimized.
This comment has been minimized.
I have a different solution to this problem, which requires a slightly newer browser, but doesn't inject styling overrides. <Dialog>
<form
onSubmit={e => {
alert("form submit!");
e.preventDefault();
}}
style={{
display: "contents"
}}
>
<DialogTitle
... This allows the inner flex element of Dialog to still be the operator of the flex-box container rules, and allows the children
Setting It'd be great to have first-class support for a " const FormDialog = (props) => <Dialog {...props} component="form" />; Or at very least, an official example of the "right" way to do this, with proper Typescript definition, etc. |
@Djspaceg Elegant solution. I can now remove all the hacks and do it once in theme level: MuiDialog: {
styleOverrides: {
paper: {
'& > form': {
display: 'contents',
},
},
},
}, |
Beware: We are still seeing this issue in 5.0.0-beta.1. This code does seem to fix it: export const Form = styled("form")({
overflowY: "auto",
display: "flex",
flexDirection: "column"
}) |
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
The text was updated successfully, but these errors were encountered: