Skip to content

Focus and Blur events #403

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

Closed
wants to merge 2 commits into from

Conversation

marcus-visikon
Copy link

@marcus-visikon marcus-visikon commented Jun 16, 2023

  • What does this PR do?
    Fixes onFocus and onBlur functionalities #17
    Added onFocus & onBlur events to OTP Input.
    These are only triggered when the previous element in focus was not one of the OTP input fields.

  • Any background context you want to provide?
    These events can be very useful for a lot of things, an good example would analytics.

  • Screenshots and/or Live Demo
    See console in example project

onfcous-blur-demo.mp4

@@ -28,6 +28,10 @@ interface OTPInputProps {
value?: string;
/** Number of OTP inputs to be rendered */
numInputs?: number;
/** Callback to be called when the OTP has lost focus */
onBlur?: () => void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not pass index here as well?

@prateek3255
Copy link
Contributor

Closing this PR @marcus-visikon Feel free to re-open it with the suggested changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

onFocus and onBlur functionalities
2 participants