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] Fix Joy UI modal dialog overflow viewport #36103

Merged
merged 6 commits into from
Feb 27, 2023

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Feb 8, 2023

close #36094

Fix

Fixed by setting maxHeight and making the ModalDialog a flex column by default, so that the children with long content can be full height overflow


@siriwatknp siriwatknp added bug 🐛 Something doesn't work component: dialog This is the name of the generic UI component, not the React module! package: joy-ui Specific to @mui/joy labels Feb 8, 2023
@mui-bot
Copy link

mui-bot commented Feb 8, 2023

Netlify deploy preview

Bundle size report

Details of bundle changes

Generated by 🚫 dangerJS against f03d097

Co-authored-by: Amandeep Singh Malhotra <amandeep.malhotra.894@gmail.com>
Signed-off-by: Siriwat K <siriwatkunaporn@gmail.com>
Signed-off-by: Siriwat K <siriwatkunaporn@gmail.com>
Signed-off-by: Siriwat K <siriwatkunaporn@gmail.com>
@siriwatknp siriwatknp merged commit 0cc4bca into mui:master Feb 27, 2023
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see it fixed 👍

In the future, we will see if developers come up with use cases to pick the scroll anchor like in https://mui.com/material-ui/react-dialog/#scrolling-long-content.


By default, `ModalDialog` will not overflow the screen when the content is longer than the viewport.

You have to apply CSS [`overflow="scroll | auto"`](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow) to the content.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the comment below

Suggested change
You have to apply CSS [`overflow="scroll | auto"`](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow) to the content.
You have to apply CSS [`overflow="auto"`](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow) to the content.

</FormControl>
<List
sx={{
overflow: scroll ? 'scroll' : 'initial',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have almost never see a case where overflow: scroll makes sense. Here is another example that reinforces it. Here is how it looks on Windows:

Screenshot 2023-03-05 at 20 07 45

Same on macOS if you enable the nonempty scrollbar which I highly recommend as it matches Windows which is >50% of what end-users experience

Screenshot 2023-03-05 at 20 10 44

auto will remove the scrollbar at the bottom.

Suggested change
overflow: scroll ? 'scroll' : 'initial',
overflow: scroll ? 'auto' : 'initial',

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another example why "nonempty scrollbar which I highly recommend": the transition jumps in on Windows https://deploy-preview-36103--material-ui.netlify.app/joy-ui/react-modal/#transition

While it doesn't on MUI Base and Material UI.

@oliviertassinari oliviertassinari changed the title [Joy] Fix modal dialog overflow viewport [Dialog] Fix Joy UI modal dialog overflow viewport Mar 5, 2023
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! package: joy-ui Specific to @mui/joy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Joy] Modal dialog should not overflow screen height
4 participants