4

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?

Antikhippe
  • 6,316
  • 2
  • 28
  • 43
Anton Styopin
  • 753
  • 4
  • 17
  • 35

2 Answers2

9

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.

Jim Barrett
  • 437
  • 5
  • 15
0

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.

VoloCorp
  • 11
  • 2