Sp_p
Sp_p

Reputation: 31

Angular material2 dialog (mat-dialog) scroll page to top when click on close.

When ever I click on the close button in mat-dialog, the scroll top position automatically reset and move to top. I am using angular material 6.1.0 version. This is happening only in IE11.

Upvotes: 3

Views: 2427

Answers (1)

SMH
SMH

Reputation: 1099

I was having the same issue with Angular material 7.3.2. When the dialog close the page scroll up. unless if I click on an element in the page then open the dialog. later, I found out that the issue is happening because there is a focused element at the top of the page (navigation button) and clicking on an element on the page removes the focus from that button.

so I added autoFocus: true and restoreFocus: false to the config object of the matdialog open method

Upvotes: 5

Related Questions