Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upMatDialog ist not centered if width is set to 100% but maxWidth is lower #17841
Comments
This comment has been minimized.
This comment has been minimized.
My guess is that the following code: was written before maxWidth was supported by MatDialog. Also I don't really understand why justifyContent shouldn't be center when width is set to 100%. |
This comment has been minimized.
This comment has been minimized.
You're right that we shouldn't be doing this when there's a |
… and there's a maxWidth A long time ago we introduced some logic that clears the `justifyContent` from a global overlay if it's `width` is set to 100%, in order to ensure that the element is flush against the viewport edge. Some time later we added a `maxWidth` option, but we never accounted for it which means that if an element is set to be `width: 100%; maxWidth: '500px'`, we'll reset the alignment incorrectly. These changes tweak the logic so it only resets if there is no `maxWidth` or if it's set to 100%. Fixes angular#17841.
Reproduction
StackBlitz: https://stackblitz.com/edit/components-issue-nvo6ox
Steps to reproduce:
{ width: '100%', maxWidth: '400px' }
Expected Behavior
What behavior were you expecting to see?
Actual Behavior
What behavior did you actually see?
Environment