Dropdown autofocus

UI Components for Vue
Post Reply
ricombnation
Posts: 24
Joined: 11 Jan 2022, 10:54

23 Aug 2022, 11:07

What is the proper way to autofocus a Dropdown component, so that I can start selecting an entry using the arrow (up / down) keys?

Besides setting the autofocus attribute on the component, I tried stuff like this:

Code: Select all

onMounted(() => {

    nextTick(() => {
     	dropdownRef.focusInput.focus();
	dropdownRef.focused = true;
    })

  }

})
But it does not work - the input only gets focus when I hit tab.

Btw. the behaviour has changed from 3.15 to 3.16. In 3.15, once I hit tab I could select an entry using the arrow keys (the menu / selection does not open). With 3.16.1, when I I hit tab, the input gets focus (blue border), and the menu / selection opens when using the arrow keys. But I cannot select an entry (using the arrow keys).

mert.sincan
Posts: 5167
Joined: 29 Jun 2013, 12:38

30 Aug 2022, 13:07

Hi,

I've added selectOnFocus option to overlay components in the next version. Details; https://github.com/primefaces/primevue/issues/2902

Best Regards,

Post Reply

Return to “PrimeVue”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 2 guests