Skip to content

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

/** 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