Skip to content

Commit 46a3fb7

Browse files
committed
refactor(input-otp): return when pasted text is empty
1 parent ecf1c11 commit 46a3fb7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

core/src/components/input-otp/input-otp.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,13 @@ export class InputOTP implements ComponentInterface {
278278
const { inputRefs, length, validKeys } = this;
279279

280280
event.preventDefault();
281-
const pastedText = event.clipboardData?.getData('text') || '';
281+
282+
const pastedText = event.clipboardData?.getData('text');
283+
284+
if (!pastedText) {
285+
return;
286+
}
287+
282288
const validChars = pastedText
283289
.split('')
284290
.filter((char) => validKeys.test(char.toLowerCase()))

0 commit comments

Comments
 (0)