htmlstreamofficial / preline

Preline UI is an open-source set of prebuilt UI components based on the utility-first Tailwind CSS framework.
https://preline.co
Other
4.9k stars 309 forks source link

Combobox will skip at least one item if arrowdown/up in vue3 #369

Closed APshZ closed 1 month ago

APshZ commented 6 months ago

Background

While using the example from https://preline.co/docs/combobox.html and put it under the vue component, find that after input value in the input field, the keydown event will trigger more than once from Argentina step to China instead of Brazil

image

The dropdown in example also have same issue for skipping items. https://stackblitz.com/edit/preline-v2-vue-and-vue-router?file=src%2Frouter%2Findex.ts,README.md

so i debug the prelinejs for combobox and find that every time route to the component which contains combobox, the autoinit function triggered and duplicate the combobox in window.$hsComboBoxCollection

image

which will lead to the more item count being skipped

Browser

Chrome, Edge

wait for fix or is it my code problem

APshZ commented 6 months ago

and my temp solution for vue <div class="relative" data-hs-combo-box="" @keydown.down.stop="combobox.onArrow(false)" @keydown.up.stop="combobox.onArrow(true)">

jahaganiev commented 1 month ago

Hey @APshZ - please check out the latest version, the issue has been fixed. Thanks!