-
-
Notifications
You must be signed in to change notification settings - Fork 741
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
Executing onBlur function on months navigation buttons #600
Comments
It hides already when the input blurs... please add a codesandbox to reproduce, thanks! |
I don't use DayPickerInput, I just use DayPicker showing and hiding it "manually" so I would like to trigger the "custom hide" function on onBlur but it triggers also if I click on months navigation buttons. |
@phlex89 sorry I don't follow :) Which is the element firing the blur event? The DayPicker? Please add a CodeSandbox to reproduce your issue, thanks: https://codesandbox.io/s/XDAE3x0W8 |
I just added an onBlur function to DayPicker: https://codesandbox.io/s/93q14zxwl4 You can see the function is triggering also on months navigation buttons. |
Thanks for the follow up. Sadly, the |
I'm having the same problem, onBlur seems to fire when there is no day selected yet and the user is paginating the months. In many form libs this makes the field marked as 'touched' and since it has no value it shows invalid. Any suggestions? |
+1. Same issue as with @petergombos It's a common approach to use |
reopened ! i’ll look on it again! |
Hi @gpbl did you get a chance to look at this? Many thanks! |
@paulcredmond this is a dirty hack I use as a workaround in the meantime |
Oh, I see what you did there @petergombos Thanks, I'll use that. |
Not yet, sorry! |
A good check to place in onBlur is the source of events
|
@apalanki Thanks, this works fine for me.
|
I'd like to look at this again but I'm not sure I understand your problem: https://codesandbox.io/s/93q14zxwl4
What you don't like here is the last step, i.e. you are saying we shouldn't call |
@gpbl Exactly! This last step makes it more difficult to use form validation. Let's say you wrap the However, we don't want to trigger the validation when the user interacts with the month pagination. After all, the user is still interacting with the day picker at that point, so it doesn't make sense to display an error. In other words, it would be better if In the case of a |
Just got a problem with same thing. @gpbl the main issue here, is that when I'm using DayPicker already reproduced in sandbox above:
So issue with |
Closing, as that input component is bugged since too long and it will be removed from the next version. |
Jump to relevant #600 (comment)
I want to hide the DayPicker to onBlur but it is triggering also when I click on navigation buttons.
How can I fix this?
The text was updated successfully, but these errors were encountered: