Closed Bug 1387190 Opened 2 years ago Closed 2 years ago

input event is not triggered for inputs using our native date/time pickers

Categories

(Firefox for Android :: General, defect)

54 Branch
All
Android
defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 57
Tracking Status
fennec + ---
firefox55 --- unaffected
firefox56 --- fixed
firefox57 --- fixed

People

(Reporter: ronny.perinke, Assigned: jchen)

References

()

Details

Attachments

(1 file)

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.
Blocks: 1386990
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 nchen@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1126e653214d
Fire "input" event for <select> and datetime <input>; r=esawin
https://hg.mozilla.org/mozilla-central/rev/1126e653214d
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 57
Is this something we should nominate for uplift to Beta or can it ride the 57 train?
Flags: needinfo?(nchen)
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
Flags: needinfo?(nchen)
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.