vue-tel-input icon indicating copy to clipboard operation
vue-tel-input copied to clipboard

fix: Error after tabbing to the dropdown field (#460)

Open daniil4udo opened this issue 9 months ago • 1 comments

Fix foe issue #460

In this fix, I have replaced the usage of v-if with v-show in instances where DOM elements are immediately targeted. Through this adjustment, we ensure smoother toggling of nodes while significantly improving performance, especially in scenarios where rapid toggling of elements occurs.

daniil4udo avatar May 06 '24 17:05 daniil4udo

it was originally v-show, we switched to v-if because of https://github.com/iamstevendao/vue-tel-input/issues/200. do you think it'll cause the same issue again?

iamstevendao avatar May 07 '24 02:05 iamstevendao

Maybe you can use a v-show and use the v-if in the list's children, so that the refList is always a list even if it's empty. I'd rather have an empty list than a null value as it produces a bug in the phone component :-(

UPDATE

Maybe you could replace this line

<li v-for="(pb, index) in sortedCountries">

with something like this

<li v-for="(pb, index) in (data.open ? sortedCountries : [])

Not sure if vue is up for it, instead you could use a computed property in the script that handles the conditional

const openedCountries = computed(() => data.open ? sortedCountries : [])

Then use this new computed property in the v-for directive by replacing sortedCountries with openedCountries This way you may still have a high performance score with only the necessary dom elements, while solving this nasty bug!

pascalvaccaro avatar Jun 05 '24 15:06 pascalvaccaro

@daniil4udo @iamstevendao @pascalvaccaro i think this fix, fix up the problem 🙏

Flo2315 avatar Jun 06 '24 05:06 Flo2315

@Flo2315 awesome. thank you!

iamstevendao avatar Jun 06 '24 12:06 iamstevendao

the fix was released on latest (v9.1.4)

iamstevendao avatar Jun 10 '24 11:06 iamstevendao