Bug 269641 - checkValidity() of input[type="date"] returns an unexpected result when an entered value is replaced by an empty string.
Summary: checkValidity() of input[type="date"] returns an unexpected result when an en...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Safari 17
Hardware: Mac (Apple Silicon) macOS 14
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-02-17 00:02 PST by ef81sp
Modified: 2024-02-24 00:03 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ef81sp 2024-02-17 00:02:36 PST
Sample on JSFiddle: https://jsfiddle.net/xL581koz/

[Summary]
- After entering a value in input[type="date"], setting an empty string "" will cause checkValidity() to return false, despite the validityState values being correct. 
- So the form cannot be submit.
- No issues occur when using form reset to clear the value.

[Expected]
For the condition,
- checkValidity() returns true.
- The form can be submitted successfully.

[How to reproduce]
1. enter a valid value in the input[type="date"] of the form. 
2. set an empty string ("") to the input element in JS.
Comment 1 Radar WebKit Bug Importer 2024-02-24 00:03:14 PST
<rdar://problem/123549879>