Usman
Usman

Reputation: 165

Angular Material Modal causes window to scroll down

Whenever an mdDialog (Angular Material modal) is opened, class="cdk-global-scrollblock" & style="left: 0px; top:0px;" is injected into the HTML body & the window is scrolled all the way down. Expected result is that the window should not scroll when modal is opened.

When modal is closed, this injected code disappears.

It seems to be a bug in Angular Material, but just curious if there is any workaround for this.

Upvotes: 2

Views: 1334

Answers (1)

Firefds
Firefds

Reputation: 49

I know this is an old question but it took my forever to find the solution. Change your cdk-global-scrollblock CSS attributes in styles.css to

.cdk-global-scrollblock {
  position: initial;
}

Upvotes: 1

Related Questions