Onchange-event not triggered when resetting non-focused date-input-field (same for time-input-field)

RESOLVED FIXED in Firefox 68

Status

()

defect
P3
normal
RESOLVED FIXED
Last year
2 months ago

People

(Reporter: gabriel, Assigned: mbrodesser)

Tracking

(Blocks 2 bugs)

60 Branch
mozilla68
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox68 fixed)

Details

Attachments

(2 attachments, 2 obsolete attachments)

Reporter

Description

Last year
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6

Steps to reproduce:

Clicked on the "x"-button of a date-input-field (that was not focused) to reset the date.
Clicked on the "x"-button of a time-input-field (that was not focused) to reset the date.

Both works fine if the field has focus (blue border).


Actual results:

The onchange-event is NOT fired.


Expected results:

The onchange-event should have been fired.

Comment 1

Last year
Hi Gabriel, thanks for reporting the issue.

What websites were you visiting where you can replicate this issue?
Component: Untriaged → DOM: Events
Flags: needinfo?(gabriel)
Product: Firefox → Core
Reporter

Comment 2

Last year
no website needed.
you can replicate it with every <input type="date" onchange="alert('changed');" />

Gabriel
Flags: needinfo?(gabriel)
I see an alert when following the steps to reproduce on
data:text/html;charset=utf-8,<input type="date" onchange="alert('changed');" />
Status: UNCONFIRMED → RESOLVED
Closed: Last year
Resolution: --- → WORKSFORME
Reporter

Comment 4

Last year
With what version on what system?

Thank you

(In reply to Henri Sivonen (:hsivonen) from comment #3)
> I see an alert when following the steps to reproduce on
> data:text/html;charset=utf-8,<input type="date" onchange="alert('changed');"
> />
(In reply to Gabriel Gritsch from comment #4)
> With what version on what system?

61.0a1 (2018-04-27) 64-bit on Ubuntu 16.04.
Reporter

Comment 6

Last year
Hi,

its still reproducible, but I found out when it is reproducible with version 60.0:
it does NOT work if a value is preset when the page is loaded and you click on the "reset"-button.

You can test it with the code on that page:

https://www.gritsch-soft.com/ff/date.html

I have also created a short screencast to show the error:

https://ufile.io/itzau (link valid for 30 days).
Reporter

Updated

Last year
Status: RESOLVED → UNCONFIRMED
Resolution: WORKSFORME → ---
Version: 59 Branch → 60 Branch
I cannot reproduce this on Nightly 62
Status: UNCONFIRMED → RESOLVED
Closed: Last yearLast year
Resolution: --- → WORKSFORME
Reporter

Comment 8

Last year
Sorry but I have to re-open it.
It is still reproducible on Nightly 62.0a1 (2018-05-26) on macOS 10.13.4 (not tested on other Systems).
Reporter

Updated

Last year
Status: RESOLVED → UNCONFIRMED
Resolution: WORKSFORME → ---
Priority: -- → P3

Comment 9

Last year
I just camed here because i encoutered the exact same issue.

I'll attach this issue a html test case. The input[date] have a default value and as you can see in the console if you clic the reset buton right after the page load the onChange event is not triggered. However if the input get the focus and then the reset buton trigger the onChange event.

The expected behavior is that no matter what the input have the focus or not if his value change then the onChange event should be triggered.

Comment 10

Last year
Posted file testcase.html

Comment 11

8 months ago
Can confirm i run into the same problem.
The Bug only appers
1. On a fresh request (because F5 and Strg+R let the predefined value disappear)
2. if the first interaction with the date field is the click on the X Icon (Once the date field get the focus, it works)
3. the value param is set (If no value is set the X Icon does not appear)

Test Code:
<input type="date" onchange="alert('changed')" value="2018-09-09" /> 

Environment: Firefox Quantum 62.0.3 (64-Bit), Ubuntu 18.04

Comment 12

8 months ago
I can reproduce this bug on Firefox Quantum 64b4 (64bit), Windows 10.

Updated

8 months ago
Component: DOM: Events → DMD

Updated

8 months ago
Component: DMD → DOM: Core & HTML
Reporter

Comment 13

6 months ago
Still no fix?
Reporter

Updated

5 months ago
Blocks: 1323674
Duplicate of this bug: 1518028
Duplicate of this bug: 1525552

Comment 16

4 months ago

this issue is not resolved from almost an year.😤

Assignee

Updated

3 months ago
Assignee: nobody → mbrodesser
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee

Comment 17

3 months ago

In order to trigger the 'onchange' event when resetting the 'date' or
'time' html input elements.

This review is only basis for discussion in order to determine if the
fix goes in the correct direction.

Assignee

Comment 18

3 months ago

:smaug: can you please have a look at the attached review (https://bugzilla.mozilla.org/attachment.cgi?id=9051306). It is just a first version, reflecting my current understanding of the code. I'm interested if the fix is going in the correct direction. Any feedback is appreciated.

Flags: needinfo?(bugs)

Took a bit time to figure out that stuff, but looks reasonable.
Store the initial value early so that we can compare later when value is set to "";

Flags: needinfo?(bugs)
Assignee

Comment 20

3 months ago

In order to trigger the 'onchange' event when resetting the 'date' or
'time' html input elements.

Attachment #9051975 - Attachment is obsolete: true
Assignee

Comment 21

3 months ago

In order to trigger the 'onchange' event when resetting the 'date' or
'time' html input elements.

Assignee

Updated

3 months ago
Attachment #9051306 - Attachment is obsolete: true
Assignee

Comment 22

3 months ago

The try run (https://treeherder.mozilla.org/#/jobs?repo=try&revision=fb92b88e86520088bd63f140da4f19d0afcf0849,) for the attached patch looks OK. It contains a few failures, but they are not related to this change.

Assignee

Updated

3 months ago
Keywords: checkin-needed
Assignee

Updated

3 months ago
Blocks: 1538124

Comment 23

3 months ago

Pushed by rmaries@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/98343ff41322
set default value for 'mFocusedValue' for the html input elements 'date' and 'time'. r=smaug

Keywords: checkin-needed

Comment 24

3 months ago
bugherder
Status: ASSIGNED → RESOLVED
Closed: Last year3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Assignee

Updated

2 months ago
Duplicate of this bug: 1541394
You need to log in before you can comment on or make changes to this bug.