-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
onChange behaviour #12
Comments
Observing the behaviour of the native time picker implemented in some modern browsers, partially clearing an input so that it's invalid (like you did) should fire onChange event with empty value. I'll consider this a bug since I strive to get a near-native experience here. |
Okay, I've done some research and it seems like native time input onChange behaviour just doesn't work with React very much. onChange sending empty values when it's only partially empty causes even the native time picker to clear if it's a controlled input |
Here's the deal. Native time picker behavior in React is, in my opinion, fundamentally broken when used as a controlled input and trying to erase the value. The solution that React-Time-Picker uses is a compromise between handling it as closely as possible and not screwing it up badly for those who prefer controlled inputs. Try and erase minutes from the first and the second input: For now, I'm adding ability to attach event listeners directly to Regarding auto-jumping from one field to another, I definitely think that would be a great addition. You can use arrow keys and |
Hi @wojtekmaj,
** e.target.value.length==0 when enetering the backspace** |
@wojtekmaj Here's a proposal. Accept a new prop This way, users could wrap |
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days. |
This issue was closed because it has been stalled for 14 days with no activity. |
@wojtekmaj any updates on this? Are those listeners implemented? |
Hi!
Reading the documentation the
onChange
event is fired only when a valid time is inserted. This could be correct, but when I delete only the minutes, theonChange
event is not fired (because time is not valid), keeping in this conjuncture the last valid value saved.For example:
First, I write 02:45, time is valid so
onChange
is fired -->state.time
= '02:45'Later, I delete only minutes, 02:--, time is invalid so
onChange
is not fired -->state.time
= '02:45'. In this case, current time is not correct sostate.time
has the last valid time, but the input is wrong.How it could be detected when a invalid time is inserted?
Thank you!
The text was updated successfully, but these errors were encountered: