Reputation: 753
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?
Upvotes: 4
Views: 3992
Reputation: 21
focusOnShow can be used only if you have p-dialog. If you are using dialog service then there is no possibility to remove autoFocus, or I just couldn't find.
Upvotes: 1
Reputation: 467
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.
Upvotes: 12