Skip to content

Commit d05d110

Browse files
committed
style: simplify nextEmptyIndex
1 parent a4dea39 commit d05d110

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -711,12 +711,8 @@ export class InputOTP implements ComponentInterface {
711711

712712
// Focus the next empty input after pasting
713713
// If all boxes are filled, focus the last input
714-
const nextEmptyIndex = validChars.length;
715-
if (nextEmptyIndex < length) {
716-
inputRefs[nextEmptyIndex]?.focus();
717-
} else {
718-
inputRefs[length - 1]?.focus();
719-
}
714+
const nextEmptyIndex = validChars.length < length ? validChars.length : length - 1;
715+
inputRefs[nextEmptyIndex]?.focus();
720716
};
721717

722718
/**

0 commit comments

Comments
 (0)