Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PrimeNG Dialog prevent autofocus on first button

I want to prevent the autofocus on the first input element when open the PrimeNG dialog.

<p-dialog header="User Details" [(visible)]="displayDialog" 
   [responsive]="true" showEffect="fade"
   [modal]="true" (onAfterHide)="onDialogHide()">
   <p-button icon="fa fa-fw fa-minus"
              label="Delete" class="delete-button">
    </p-button>
</p-dialog>

Is there a possibility to prevent the autofocus?

like image 529
Anton Styopin Avatar asked Jan 03 '23 15:01

Anton Styopin


1 Answers

Not sure if you're still looking for an answer but there is a focusOnShow attribute for p-dialog which defaults to true. Set it to false will stop focusing on the first button. Not sure which version of PrimeNG this was introduced in.

like image 68
Jim Barrett Avatar answered Jan 05 '23 15:01

Jim Barrett