Closed Bug 1387190 Opened 2 years ago Closed 2 years ago
input event is not triggered for inputs using our native date/time pickers
User Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0 Build ID: 20170726200247 Steps to reproduce: I have an Angular app and I tried to change a date through the native datepicker. Actual results: Angular relies on the input event (https://github.com/angular/angular/blob/master/packages/forms/src/directives/default_value_accessor.ts#L52). Because there is no input event, the value of the FormControl is not updated. Form validation fails and of course the value is always null (or whatever the initial value was). Expected results: The input event should be emitted so that frameworks like Angular or Reac get notified about the new value.
This bug is very similar to bug #1267638 and the same test from there can be used here. The test case shows that there is no input event when using Fennec but when using Desktop (with dom.forms.datetime enabled of course). Also, Fennec emits the input event for other input types but not for date, datetime-local and month (I guess for all input that use the datepicker of Fennec). Right now, it requires a workaround such as the one posted at https://stackoverflow.com/q/45441842 or a custom ControlValueAccessor that listens to the change event as well.
Interesting coincidence with bug 1386990 there - in any case I can confirm this and we should fix it.
Status: UNCONFIRMED → NEW
tracking-fennec: --- → ?
Ever confirmed: true
OS: Unspecified → Android
Hardware: Unspecified → All
Summary: input event is not triggered for input type=date → input event is not triggered for inputs using our native date/time pickers
Assignee: nobody → nchen
tracking-fennec: ? → +
Fire "input" event in addition to "change" event for both <select> fields and date/time <input> fields.
Attachment #8896004 - Flags: review?(esawin)
Attachment #8896004 - Flags: review?(esawin) → review+
Pushed by email@example.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/1126e653214d Fire "input" event for <select> and datetime <input>; r=esawin
Is this something we should nominate for uplift to Beta or can it ride the 57 train?
Comment on attachment 8896004 [details] [diff] [review] Fire "input" event for <select> and datetime <input> (v1) We can uplift. Approval Request Comment [Feature/Bug causing the regression]: N/A [User impact if declined]: Some web frameworks like Angular or React may not properly respond to date/time picker changes. [Is this code covered by automated tests?]: No [Has the fix been verified in Nightly?]: Yes [Needs manual test from QE? If yes, steps to reproduce]: No [List of other uplifts needed for the feature/fix]: None [Is the change risky?]: No [Why is the change risky/not risky?]: Small patch that's been well tested. [String changes made/needed]: None
Attachment #8896004 - Flags: approval-mozilla-beta?
Comment on attachment 8896004 [details] [diff] [review] Fire "input" event for <select> and datetime <input> (v1) A small fix for date/time picker changes. Beta56+.
Attachment #8896004 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.