Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove auto focus on button inside angular material modal?

When we place button inside angular material dialog it is auto focussing first button in that modal.

Stackblitz example

like image 507
mani singh Avatar asked Feb 12 '19 07:02

mani singh


1 Answers

You can add the autofocus = false properties to the dialog to disable the auto focus.

Example as below:

const dialogRef = this.dialog.open(DialogOverviewExampleDialog, {
   width: '250px',
   data: {name: this.name, animal: this.animal},
   autoFocus: false 
});
like image 88
Khai Kiong Avatar answered Sep 20 '22 11:09

Khai Kiong