0
votes

I have in my angular app a dropdown from PrimeNG. This dropdown has set autofocus property to true.

So, when I'm opening my component (or dialog) which has this dropdown inside everything is ok, dropdown has focus and i can select options by keys.

But when I'm going to other place in app and then came back to component with dropdown (or reopen dialog), autofocus on dropdown is not set (I checked that now focus is set on document body).

Is there any possibility to fix this issue?

1

1 Answers

0
votes

Ok, I figured it out.

In my component which has dropdown inside I add:

@ViewChild('dropdown') dropdown: Dropdown;

And then when component is loaded (or dialog open - in onShow event) I used method from Dropdown:

this.dropdown.applyFocus();