Dropdown Menu & disableFocusFirstItem #1232
Unanswered
daniellovera
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
Sharing this as it might be helpful to others. I used the DropdownMenu component and, after triggering the menu open, did not want to have the first item to be focused. I tried setting
disableFocusFirstItem={true}
but that didn't work.However, when I changed
data-[highlighted]
tofocus
here in the component, it did work correctly:https://github.com/huntabyte/shadcn-svelte/blob/main/sites%2Fdocs%2Fsrc%2Flib%2Fregistry%2Fdefault%2Fui%2Fdropdown-menu%2Fdropdown-menu-item.svelte#L17
I'm not sure if I broke something in doing this, but I didn't find any other issues and saw a couple questions like this on Stack Overflow so I thought I'd share in case it saves anyone else the aggravation.
Thanks again for building these awesome libraries @huntabyte !
Beta Was this translation helpful? Give feedback.
All reactions