gyurielf / svelte-tel-input

Svelte Tel Input
https://svelte-tel-input.vercel.app/
MIT License
97 stars 11 forks source link

Problem with clickOutsideAction in webcomponent setup #170

Open nosovk opened 1 year ago

nosovk commented 1 year ago

I'm trying to create webcomponent that will wrap sveltecomponent to use it in html templates. Here is a repro: https://github.com/nosovk/KBC-webcomponents here is testing page: https://kbc-webcomponents.vercel.app/lib/

Integration seems to be easy, except one problem.

image

It seems that clickOutsideAction blocks another handler from firing (handleSelect(country.iso2, e);). If I remove clickOutsideAction click handler works as expected.

Could you please modify clickOutsideAction to not prevent other events in a flow?

nosovk commented 1 year ago

probably move to https://github.com/sveltejs/site-kit/blob/master/packages/site-kit/src/lib/actions/click-outside.js can help?

gyurielf commented 1 year ago

I'll adjust it. I make the prevent checking optional.

Otherwise, it's just a utility fn, not necessary to use or you can use your ow implementation. The main purpose was provide all of the utilities which needs to make a proper phone input.

nosovk commented 1 year ago

hm, I found that I can create my own function, but it seems that any capture: true brokes clicks on language items

gyurielf commented 1 year ago

I walked around the issue, if I uncheck Ancestors, just the button event listeners remains. Did you manage to fix this or need some help ?

nosovk commented 1 year ago

Nope, wasn't able to fix. I think that problem could be in custom element's wrapper, but wasn't able to confirm the actual reason of bug.