react icon indicating copy to clipboard operation
react copied to clipboard

change event is not fired for input type=date

Open dan-codes-16 opened this issue 11 years ago • 23 comments

Hello,

It seems like change event is not fired for input type=date in mobile Firefox on Android.

Please try the following jsFiddle code for example http://jsfiddle.net/adaniliuk/srt6mp0p/

May be I'm doing something wrong? But the above code works well in Chrome, Safari and desktop Firefox but not in mobile Firefox - tested in Firefox v.37.0.1 on Android 5.1

Just in case vanilla JavaScript works well in this case http://jsfiddle.net/adaniliuk/voueyub9/

Thank you in advance, Andrei

dan-codes-16 avatar Apr 13 '15 10:04 dan-codes-16

cc @syranide @salier - do we need to special case this & listen to a different event there?

zpao avatar Apr 21 '15 18:04 zpao

cc @spicyj I think?

syranide avatar Apr 21 '15 18:04 syranide

I'm using react 0.13.1, and I encounter the same issue, but it's on Android 4.1.2

so I have to use the onBlur as a fallback in case the onChange callback not executed

nate-tsai avatar May 08 '15 08:05 nate-tsai

^ Also broken on Chrome per #4733.

sophiebits avatar Aug 28 '15 20:08 sophiebits

I don't think #4733 is the same issue? or if it is then this probably isn't a bug. I think this is the intended behavior. If the picker is missing some part of the date, its not possible for it to have a value since its not a valid date. The issue is that as long as any part of the picker is empty it won't fire a change (or input). Once all parts any filled in any change to a given part will fire a change.

If you wanted to "correct" this choice tho I am not sure how'd you do it, since the input gives no feedback in vanilla js either when this happens (clicked with a mouse that is).

jquense avatar Dec 17 '15 21:12 jquense

Hi there, I'm also taken to this case: https://jsfiddle.net/02nxr8bc/1/ Would be awesome if you still can fix it.

Thanks in advance. Felix

felixgeelhaar avatar May 04 '16 18:05 felixgeelhaar

Is there any ETA for this? It completely breaks controlled date inputs for Firefox Android.

AdamBoxall avatar May 13 '16 15:05 AdamBoxall

@AdamBoxall You're welcomed to submit a pull request.

jimfb avatar May 13 '16 18:05 jimfb

I dug into this just now. I can't reproduce the issue on React 15.2.1. I'm going to trace back and see when it was fixed.

nhunzaker avatar Jul 18 '16 17:07 nhunzaker

Yikes. Wrong. This is broken on React 15.2.1. It only appears to have been fixed on master (16.0.0-alpha).

nhunzaker avatar Jul 18 '16 18:07 nhunzaker

@nhunzaker Mind bisecting to figure out which commit fixes it and needs to be cherry-picked?

sophiebits avatar Jul 18 '16 18:07 sophiebits

@spicyj doing it now :)

nhunzaker avatar Jul 18 '16 18:07 nhunzaker

Sorry for the double post..

Looks like: 045f1a791c6e17253e9d927ffca70ae5d00b4fe5

Awesome work, @jquense.

nhunzaker avatar Jul 18 '16 18:07 nhunzaker

If it helps, here's my test script to reproduce:

https://gist.github.com/nhunzaker/428f9f1283e790b152254510dd92afbe

I just ran it locally on my Android phone from examples/date/index.html.

nhunzaker avatar Jul 18 '16 19:07 nhunzaker

@spicyj I went ahead and put in the legwork to backport this in the following PR: https://github.com/facebook/react/pull/7303. Assuming this is viable, I wouldn't mind backporting it to 0.14.x and 0.13.x if possible (or interest)

nhunzaker avatar Jul 19 '16 13:07 nhunzaker

Is there any workaround until react 16.0.0 is released?

clemp6r avatar Feb 17 '17 10:02 clemp6r

Tried 16.0.0-alpha.3, but onChange event wasn't fired on type date

Gregoirevda avatar Jun 20 '17 22:06 Gregoirevda

I'm fairly certain we've confirmed these issues are fixed yes?

jquense avatar Aug 10 '17 11:08 jquense

Closed, but still NOT working

albertotorresfoltyn avatar Dec 14 '17 19:12 albertotorresfoltyn

Note you might be getting this because the browser doesn't emit any events for invalid dates: https://github.com/facebook/react/issues/12056#issuecomment-359109709

gaearon avatar Jan 19 '18 22:01 gaearon