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)
Tracking
()
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.
Comment 1•6 years ago
|
||
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.
Reporter | ||
Comment 2•6 years ago
|
||
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.
Comment 3•6 years ago
|
||
Comment 4•6 years ago
|
||
Comment 5•6 years ago
|
||
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.
Reporter | ||
Comment 6•6 years ago
|
||
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.
Comment 7•6 years ago
•
|
||
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.
Description
•