question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Dialog] Better mobile default margin?

See original GitHub issue

When I set the dialog as fullWidth={true} I expect it to take whole screen up to maxWidth. On mobile, width is calculated as width: calc(100% - 96px);, the 96px coming from the rule just below margin: 48px;. So, it actually does not take full width and it just looks bad.

  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 🤔

Current Behavior 😯

It takes width minus margin, which in the case is 48px at each side ( well, top and bottom as well, but that does not matter)

Steps to Reproduce 🕹

Link: to sandbox

Context 🔦

Just trying to have a full width feature to work properly. I did try to change the paperFullWidth: property, but that ends up changing the root element.

Your Environment 🌎

Tech Version
Material-UI v4.1.3
React 16.8.6
Browser Firefox development latest
TypeScript
etc.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:23 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
vipertechofficialcommented, Apr 8, 2021
dialog: {
        [theme.breakpoints.down('sm')]: {
            "& .MuiDialog-container .MuiDialog-paper": {
                margin: "24px 0px",
                borderRadius: 0
            },
        }
    }
2reactions
m2mathewcommented, Jul 20, 2019

I made a dialog yesterday that looks like this on mobile.

image

I did it by passing down this prop to the Dialog component:

classes={{ paper: classes.dialogPaper }}

Which is applying this style from jss:

dialogPaper: {
  [theme.breakpoints.down(480)]: {
    margin: 24,
  },
},

It seems in line with what @BernardA is wanting. I am overriding the margin for the dialog on a smaller screen (he would want margin: 0, seemingly) and also using a maxWidth of xs for the dialog.

From the MUI Docs

Screenshot 2019-07-20 09 18 44

fullWidth will cause the content inside the dialog to stretch to meet one of the enumerated maxWidth values (“xs”, “sm”, et al.). I find no confusion with the way that this API is named considering it matches the way that CSS works since those enumerations are stand-ins for real width values (300px, 440px, et all).

That being said, perhaps @oliviertassinari’s proposed wording update would help, too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set dialog outer margins? (Android) - Stack Overflow
You can use a inset to set margins to a Custom dialog . Look, the android:drawable attribute is calling my dialog custom background....
Read more >
How to Size and Position the MUI Dialog Component - Medium
Dialog Size Props​​ There is no margin or anything else. Interestingly, the DOM div that acts as the modal is still present in...
Read more >
Building a dialog component - web.dev
Open and auto focus an element # By default, the dialog element will assign focus to the first focusable element in the dialog...
Read more >
Dialogs - Material Design
Dialogs can reach a maximum height and width of 560dp on large screens. Dialogs can also swap types as a screen size changes....
Read more >
Dialogs - jQuery Mobile Demos
When the "dialog" attribute is applied, the framework adds styles to add rounded corners, margins around the page and a dark background to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found