[Webkit-unassigned] [Bug 223465] New: input[type=date] fires a change event before user can select a date if no initial value

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Mar 18 12:13:33 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=223465

            Bug ID: 223465
           Summary: input[type=date] fires a change event before user can
                    select a date if no initial value
           Product: WebKit
           Version: Safari 14
          Hardware: Unspecified
                OS: iOS 14
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Forms
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: bugs at emorycottage.net
                CC: cdumez at apple.com, wenson_hsieh at apple.com

Steps to Reproduce
Use this page: https://jsfiddle.net/e8ngLvmp/ or build a page with input type=date and no value attribute: <input type="date" name="date1" id="date1">
Hook the change event:
document.getElementById("date1").addEventListener("change",function() {
        alert('Change event signaled; value='+document.getElementById("date1").value);
});

Load the page using an iPad running iOS 14.41 and Safari 14.4, then touch or tap the date input element. (Not tested with other Apple devices.)

Expected behavior

The alert is shown after the user has selected a date using the date picker and the alert displays the selected date.

Actual behavior

The change event is fired as soon as the input field is tapped, the alert displays the current date, and the date picker is not shown until the alert is dismissed. Regardless of the date selected in the date picker, the input element shows the current date.

Notes:
This failure occurs only in the case that the input element has no value attribute. The date picker is focused on the current date, which is the only reasonable thing to do, but the current date is also set as a value on the input element and the change event signaled. That is the error.  This only happens when a page showing this behavior is initially loaded.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210318/aa13a7ff/attachment.htm>


More information about the webkit-unassigned mailing list