Skip to content

MatDialog ist not centered if width is set to 100% but maxWidth is lower #17841

Closed
hrueger/AGLight
#112
@dardanbujupaj

Description

@dardanbujupaj

Reproduction

StackBlitz: https://stackblitz.com/edit/components-issue-nvo6ox

Steps to reproduce:

  1. Open a component as a MatDialog using following configuration
    { width: '100%', maxWidth: '400px' }
  2. Adjust the window width, so that exceeds the dialog-maxWidth of 400px

Expected Behavior

What behavior were you expecting to see?

  • The dialog grows up to its max width of 400px
  • As soon as the maxWidth is hit, the dialog stays the same width and is centered on the window

Actual Behavior

What behavior did you actually see?

  • The dialog is positioned as expected if the width is configured to 99% or lower
  • The dialog is aligned to the left of the window if the width configured to 100%
  • see StackBlitz link above

Environment

  • Angular: 8.2.14
  • CDK/Material: 8.2.3
  • Browser(s): Firefox
  • Operating System (e.g. Windows, macOS, Ubuntu): Linux

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaround

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions