rob-balfre / svelte-select

Svelte Select. A select component for Svelte
https://svelte-select-examples.vercel.app
Other
1.25k stars 175 forks source link

Use in modal with click outside to close modal #619

Closed zwergius closed 10 months ago

zwergius commented 11 months ago

Hey,

First of all I appreciate all the work you have put into this component!

I am having an issue where when I use this component in a custom modal component that has click outside to close the modal.

If svelte-select is focused and click-outside from the modal is triggered then my app crashes, I believe this is caused by the modal being removed from the dom and this conflicts with svelte-selects own click-outside. I am unsure what can be done to accommodate this. I know I could block my own click-outside until svelte-select is blurred, but that would mean 2 clicks outside to close the modal which isn't exactly ideal.

rob-balfre commented 11 months ago

REPL please or difficult to help. Thanks

zwergius commented 10 months ago

Hey,

So while preparing this REPL it became clear that this probably wasn't an issue with your component, I found an issue in the svelte repo that there had been a re-write of the whole component destroy logic and that this was available in svelte 4. So I decided to update and I am happy to announce that this issue no longer appears.

Thanks