Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6632 InputOtp keyboard navigation #6638

Merged
Merged
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 components/lib/inputotp/InputOtp.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,14 @@ export const InputOtp = React.memo(
break;
}

case 'Tab':

case 'Enter': {
break;
}

default: {
// Prevent non-numeric characters from being entered if integerOnly is true or if the length of the input is greater than the specified length
//Prevent non-numeric characters from being entered if integerOnly is true or if the length of the input is greater than the specified length
if ((props?.integerOnly && !((event.code.startsWith('Digit') || event.code.startsWith('Numpad')) && Number(event.key) >= 0 && Number(event.key) <= 9)) || (tokens.join('').length >= props.length && event.code !== 'Delete')) {
event.preventDefault();
}
Expand Down
Loading