Skip to content

Commit

Permalink
handle arrow up, down
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 committed Jan 17, 2024
1 parent b8b382f commit bb2f3a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/data/base/components/input/OTPInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ function OTP({ seperator, inputCount, otp, setOtp }) {

const handleKeyDown = (event, currentIndex) => {
switch (event.key) {
case 'ArrowUp':
case 'ArrowDown':
event.preventDefault();
break;
case 'ArrowLeft':
event.preventDefault();
if (currentIndex > 0) {
Expand Down
4 changes: 4 additions & 0 deletions docs/data/base/components/input/OTPInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ function OTP({
currentIndex: number,
) => {
switch (event.key) {
case 'ArrowUp':
case 'ArrowDown':
event.preventDefault();
break;
case 'ArrowLeft':
event.preventDefault();
if (currentIndex > 0) {
Expand Down

0 comments on commit bb2f3a8

Please sign in to comment.