Closed Bug 1569596 Opened 5 years ago Closed 5 years ago

Input Type Date Doesn't Fire Change Event When A date is Selected from the Popup that Matches Current Date

Categories

(Core :: DOM: Core & HTML, defect)

68 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: andymercer, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0

Steps to reproduce:

Step 1: Create a webpage with the following HTML code in the body.

<input type="date" id="test-date" />
<script>
var test = document.getElementById("test-date");
test.addEventListener("change", function(event){
console.log(event);
});
</script>

Step 2: Open webpage and click on the input.
Step 3: Select a date.
Step 4: Click on the input again.
Step 5: Select the same date.

Actual results:

The change event is only fired once. The second time the datepicker is clicked on, it doesn't fire the change event.

Expected results:

The change event should fire twice. Once for each time the popup datepicker is clicked on.

Hi @Andy Mercer, I've checked the issue on Windows 10 machine on several FF versions: release 68.0a1, beta 69.0b9, nightly 70.0a1. Cannot reproduce but the event will not be triggered every time you press the datapicker until you select a date. Selecting the same data, I guess is intended to not trigger another time the same data. If you select another one the picker woks accordingly- can be seen in screenshots attached- were was tested even in Chrome(same behavior).
So, in conclusion in my opinion this isn't an issue. If you refer to some other actions made and there are not described into description, please provide those info.
Further, I will add a component and let someone from the dev's team to pronounce about it.
Also there is a meta bug for that: 1323674
Thanks.

Component: Untriaged → DOM: Core & HTML
Flags: needinfo?(andymercer)
Product: Firefox → Core

My issue is that I can't detect when the datepicker popup closes. It closes when I select a date, regardless of whether the input's date has actually changed. But the 'change' event only fires if the input's date has changed. I need a date to detect when the popup closes, every time it closes.

Flags: needinfo?(andymercer)

The pop-up (calendar picker data) shows up by clicking on the data input / closes when you select a date or clicking outside the input data.

Consider this series of events:

I click on a date input and the calendar popup opens.
I select 2019-01-01. The popup closes and the change event fires.
I click on the date input and the calendar popup opens.
I select 2019-01-01. The popup closes, and NO change event fires. And no click event fires that I could track.

There is no way to tell, in that case, that the calendar popup has closed.

From the spec "For input elements without a defined input activation behavior, but to which these events apply, and for which the user interface involves an explicit commit action but no intermediate manipulation, then any time the user commits a change to the element's value, the user agent must queue a task to first fire an event named input at the input element, with the bubbles attribute initialized to true, and then fire an event named change at the input element, with the bubbles attribute initialized to true."
But here there isn't any change here.

If you want a spec (https://html.spec.whatwg.org/) change, file a spec bug https://whatwg.org/newbug
Once there is a spec change, we could change Gecko's behavior.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: