Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/lib/hooks/useOTP.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ const useOTP = ({ autoFocus, value, otpType, onChange, OTPLength }) => {
case "Backspace":
e.preventDefault();
changeActiveInputValue("");
focusInputByDirection("prev");
/**
* This will make easy to change the current input feild without following a long process of prev input to the next input.
*/

if (e.target && e.target.value === "" || e.target.value === undefined || e.target.value === null) {
focusInputByDirection("prev");
}
break;
case "Delete":
e.preventDefault();
Expand Down