Skip to content

Commit

Permalink
fix selction
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 committed Jan 16, 2024
1 parent d67da7c commit 23ee497
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/data/base/components/input/OTPInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ function OTP({ seperator, inputCount, otp, setOtp }) {
const handleKeyDown = (event, currentIndex) => {
switch (event.key) {
case 'ArrowLeft':
event.preventDefault();
if (currentIndex > 0) {
event.preventDefault();
focusInput(currentIndex - 1);
selectInput(currentIndex - 1);
}
break;
case 'ArrowRight':
event.preventDefault();
if (currentIndex < inputCount - 1) {
event.preventDefault();
focusInput(currentIndex + 1);
selectInput(currentIndex + 1);
}
Expand Down
4 changes: 2 additions & 2 deletions docs/data/base/components/input/OTPInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ function OTP({
) => {
switch (event.key) {
case 'ArrowLeft':
event.preventDefault();
if (currentIndex > 0) {
event.preventDefault();
focusInput(currentIndex - 1);
selectInput(currentIndex - 1);
}
break;
case 'ArrowRight':
event.preventDefault();
if (currentIndex < inputCount - 1) {
event.preventDefault();
focusInput(currentIndex + 1);
selectInput(currentIndex + 1);
}
Expand Down

0 comments on commit 23ee497

Please sign in to comment.