CaptainCodeman / svelte-headlessui

HeadlessUI components for Svelte
https://captaincodeman.github.io/svelte-headlessui/
MIT License
554 stars 25 forks source link

onSelect not getting fired for Combobox #25

Closed rohanrajpal closed 1 year ago

rohanrajpal commented 1 year ago

In the following docs for combobox

https://captaincodeman.github.io/svelte-headlessui/combobox/

If you select any element from the list, it does not call the onSelect method. This can be verified by just opening the console & no log is printed when an item is selected. If you open the docs for listbox on the other hand, the console log works as expected. Also verified by using the library myself & the onSelect is not gettting fired.

Additionally, I I search for something that is not in the list, the following error shows up

image

Let me know if I can help in fixing this issues, once again, thanks for the effort!

CaptainCodeman commented 1 year ago

Thanks for the catch!

I think the example code was wrong with the event listener added to the outer button (which isn't actually used as a button)

rohanrajpal commented 1 year ago

Thanks for the catch!

I think the example code was wrong with the event listener added to the outer button (which isn't actually used as a button)

You're welcome! Also shall I create a new issue for the error that comes up when you search for something that is not in the list?

Example: Try typing "fasfa" in the combobox example & notice the error in the console.

CaptainCodeman commented 1 year ago

Yes please, I just realized it didn't fix that too (I wasn't pressing enter after)

CaptainCodeman commented 1 year ago

Actually, it's pretty quick - I'll just tack it on to this issue

CaptainCodeman commented 1 year ago

Hopefully that sorts it, thanks again for the issue :)