vue3-otp-input icon indicating copy to clipboard operation
vue3-otp-input copied to clipboard

otpInput.value.clearInput() does not clear the very last num input field

Open AguilarTech opened this issue 2 years ago • 3 comments

I am using the otpInput as below:

<v-otp-input ref="otpInput" inputmode="numeric" separator="" :num-inputs="6" :should-auto-focus="false" :is-input-num="true" :placeholder="['', '', '', '', '', '']" @on-complete="handleOnComplete" />

But when I call otpInput.value.clearInput() in the handleOnComplete() it clears only the first 5 inputs but not the last one.

Not sure if I am doing something wrong or if this a something that happens:

image

Just want to be able to clear it in case the user needs a new code resent.

Also I am not finding how to programmatically focus the first input when required, tried otpInput.value.focus() but it didn't work. Say when the OTP code has been sent to the user.

otpInput.value.focusInput(0) goes to the 2nd input:

image

Is this an issue or working as expected? Any help appreciated.

AguilarTech avatar Sep 01 '22 11:09 AguilarTech

@ejirocodes @AguilarTech

Is help still needed? Would love to contribute and resolve

D-Lite avatar Oct 03 '22 16:10 D-Lite

@D-Lite sure. Please do

ejirocodes avatar Oct 03 '22 18:10 ejirocodes

@D-Lite

yes please, still stuck on this, not sure how to fix

AguilarTech avatar Oct 04 '22 06:10 AguilarTech

I have the exact same 2 issues and the package is not really useful for me with these bugs.

EDIT: I could actually fix both by putting v-if with a setTimeout on the component.

vptill avatar Mar 06 '23 09:03 vptill

@vptill, @AguilarTech @D-Lite this has been fixed in the latest release

ejirocodes avatar Mar 28 '23 07:03 ejirocodes