-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Error ng-invalid-date whe then user clicks "X" in Chrome #14740
Comments
Copying some comments over from #12853 for context: Interesting facts:
Suggestions:For users: As a workaround, you can trigger an For Chrome: Always trigger an input event, when the user clicks "X". For us: Not sure. Listening for /cc @jbedard (who fixed the previous bug) |
The mousedown is also for the up/down arrows to increment/decrement part of the date (which changes on mousedown, if you hold the mouse down it continuously increment/decrements it - so I think keeping mousedown is valuable). If adding mouseup or click to the list of events listened to works then I think that's fine. I think I'd want to avoid a hardcoded delay though. |
1.5.3使用mousedown解決angular/angular.js#14740
You can also use ngModelOptions with updateOn and debounce to work around this problem:
|
Note that the native Firefox date widget (tested in Dev tools) works completely different, too. |
Changing input's value without triggering input event is clearly a bug in Chrome. |
Theoretically, it is not a bug, because I don't think there any spec about the And technically the value does not change, because as long as you have only selected a partial date, the input's It is a little weird that the event is fired the first time though. In any case, I don't know if anyone has raised it in Chrome's bug tracker. |
That's why we are talking about input event not change event here; the value does not change but there was input from user registered. Btw, validity state (https://developer.mozilla.org/en-US/docs/Web/API/ValidityState) for input's DOM element is being updated correctly after clicking clear button (every time not just on the first click). Could AngularJS update its $valid state on change in validity state instead of trying to enumerate and listen to all events which might result in changing input's value? |
We do take Validity into account . But how would we know that Validity has changed? We need an event to trigger that check. |
Hi
I found another problem in Chrome.
1.Key in Month or Date or Year.Dot not use choose.
2.Use the "X" to clear the value -->Now $valid=true -->expect
3.Key in Month or Date or Year again.
4.Use the "X" to clear the value -->Now $valid=false -->error
http://plnkr.co/edit/2HPDq0bjzReyuNbvn7vz?p=preview
Reference Issue
#12853 (comment)
@gkalpak
The text was updated successfully, but these errors were encountered: