Skip to content

Commit cb8015d

Browse files
authored
feat(VOtpInput): allow to keep focus on paste (#21275) (#21356)
1 parent 5e1d653 commit cb8015d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/vuetify/src/components/VOtpInput/VOtpInput.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,13 @@ export const VOtpInput = genericComponent<VOtpInputSlots>()({
167167
e.stopPropagation()
168168

169169
const clipboardText = e?.clipboardData?.getData('Text').slice(0, length.value) ?? ''
170+
const finalIndex = clipboardText.length - 1 === -1 ? index : clipboardText.length - 1
170171

171172
if (isValidNumber(clipboardText)) return
172173

173174
model.value = clipboardText.split('')
174175

175-
inputRef.value?.[index].blur()
176+
inputRef.value?.[finalIndex].focus()
176177
}
177178

178179
function reset () {

0 commit comments

Comments
 (0)