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

Added event object to onBlur method sent through textInputProps #840

Merged
merged 2 commits into from
Sep 19, 2022

Conversation

tonibardina
Copy link
Contributor

It would be good to send the event object to the onBlur method set in textInputProps by the user. Otherwise, end users might have issues using libraries like formik for validation.

@ashuvssut
Copy link
Collaborator

ashuvssut commented Sep 17, 2022

@tonibardina Thankyou for the PR

I checked the formik docs, I can't find event object being passed to onBlur. I can see onChange has an event object.
image
ref https://formik.org/docs/api/useField#fieldinputpropsvalue

I might be missing something. Can you tell me where did you find event object being passed in onBlur in formik. I can not find it in the formik docs.

You can also show if you have encountered any other use case of the event object

@tonibardina
Copy link
Contributor Author

tonibardina commented Sep 19, 2022

Hello @ashuvssut, you can find it here -> https://formik.org/docs/api/formik#handleblur-e-any--void , check handleBlur: (e: any) => void. Btw I think it would be useful also to have it in case we want to gather some info about the input element on the onBlur event.

@ashuvssut
Copy link
Collaborator

ashuvssut commented Sep 19, 2022

all right @tonibardina

I am not sure but I think this same thing is not applicable for onFocus event, right? I can not find handleFocus anywhere mentioned in that link you mentioned. Is event object passed into onFocus too? If yes, then we should make the same changes for onFocus too

@tonibardina
Copy link
Contributor Author

tonibardina commented Sep 19, 2022

all right @tonibardina

I am not sure but I think this same thing is not applicable for onFocus event, right? I can not find handleFocus anywhere mentioned in that link you mentioned. Is event object passed into onFocus too? If yes, then we should make the same changes for onFocus too

I believe there is no such event in formik but it might be interesting to add it to let users use the event object for their own purposes as well as might be helpful for other libraries that might need it. I can add it in this same PR if you think its appropiate.

@ashuvssut
Copy link
Collaborator

@tonibardina I agree. There might be other libraries that might need this event object. Lets add it too

@ashuvssut ashuvssut merged commit 3c57bb6 into FaridSafi:master Sep 19, 2022
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.

4 participants