bug(MatDialog): alignment issue with width 100% (TS) & default max-width (CSS) #29058
Closed
1 task done
Labels
needs triage
This issue needs to be triaged by the team
Is this a regression?
The previous version in which this bug was not present was
16
Description
When using MatDialog's
open
method with{ width: 100% }
and defaultmax-width
(set in the styles), the dialog is not centered (because.cdk-global-overlay-wrapper
receivesjustify-content: flex-start
).This behavior seems to be caused by
global-position-strategy
file that containsshouldBeFlushHorizontally
check that doesn't know that the dialog hasmax-width
set in the CSS.It works fine with, for example,
maxWidth: '80vw'
set in theopen
method's config (MatDialogConfig) OR if weopen
the dialog with{ width: '99%' }
.It worked fine in v16.
Reproduction
StackBlitz link: https://stackblitz.com/edit/kmkyqc?file=src%2Fexample%2Fdialog-content-example-dialog.html
Steps to reproduce:
Expected Behavior
In the case above, the dialog should be centered (
shouldBeFlushHorizontally
probably should take current/default dialog's styles to account (not only those set inopen
method's config)).Actual Behavior
Dialog is aligned to start when its width is set to 100% in the
open
method's config, but it has applied a style withmax-width
.Environment
The text was updated successfully, but these errors were encountered: