Skip to content

Date/time input types without min/max should not match :in-range pseudo-class#62793

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
cdumez:312344_datetime_min_max_check
Apr 15, 2026
Merged

Date/time input types without min/max should not match :in-range pseudo-class#62793
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
cdumez:312344_datetime_min_max_check

Conversation

@cdumez
Copy link
Copy Markdown
Contributor

@cdumez cdumez commented Apr 15, 2026

f8ae15f

Date/time input types without min/max should not match :in-range pseudo-class
https://bugs.webkit.org/show_bug.cgi?id=312344

Reviewed by Anne van Kesteren.

Date and time input types (date, time, week, month, datetime-local)
unconditionally passed RangeLimitations::Valid when creating their
StepRange, causing inputs without min/max attributes to incorrectly
match :in-range. NumberInputType correctly only set Valid when a min
or max attribute was actually present and parseable.

Apply the same pattern from NumberInputType to all five date/time
input types: start with RangeLimitations::Invalid and only promote
to Valid when an attribute parses to a finite number.

No new tests, rebaselined existing WPT test that was already passing
in Chrome and Firefox.

* LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/inrange-outofrange-expected.txt:
* Source/WebCore/html/DateInputType.cpp:
(WebCore::DateInputType::createStepRange const):
* Source/WebCore/html/DateTimeLocalInputType.cpp:
(WebCore::DateTimeLocalInputType::createStepRange const):
* Source/WebCore/html/MonthInputType.cpp:
(WebCore::MonthInputType::createStepRange const):
* Source/WebCore/html/TimeInputType.cpp:
(WebCore::TimeInputType::createStepRange const):
* Source/WebCore/html/WeekInputType.cpp:
(WebCore::WeekInputType::createStepRange const):

Canonical link: https://commits.webkit.org/311279@main

2c601d3

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ⏳ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 🧪 win-tests ⏳ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ⏳ 🛠 vision-apple
🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@cdumez cdumez self-assigned this Apr 15, 2026
@cdumez cdumez added the DOM For bugs specific to XML/HTML DOM elements (including parsing). label Apr 15, 2026
@cdumez cdumez force-pushed the 312344_datetime_min_max_check branch from 36ba74b to 2c601d3 Compare April 15, 2026 05:31
@cdumez cdumez marked this pull request as ready for review April 15, 2026 09:23
@cdumez cdumez requested a review from rniwa as a code owner April 15, 2026 09:23
@cdumez cdumez requested review from annevk and darinadler April 15, 2026 09:23
Copy link
Copy Markdown
Contributor

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find ::Invalid a bit confusing given that these controls are valid, but I'm not sure if renaming that to ::NotApplicable would actually be good in the larger scheme of things and that's probably best done as a separate refactor anyway.

@cdumez cdumez added the merge-queue Applied to send a pull request to merge-queue label Apr 15, 2026
…do-class

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

Reviewed by Anne van Kesteren.

Date and time input types (date, time, week, month, datetime-local)
unconditionally passed RangeLimitations::Valid when creating their
StepRange, causing inputs without min/max attributes to incorrectly
match :in-range. NumberInputType correctly only set Valid when a min
or max attribute was actually present and parseable.

Apply the same pattern from NumberInputType to all five date/time
input types: start with RangeLimitations::Invalid and only promote
to Valid when an attribute parses to a finite number.

No new tests, rebaselined existing WPT test that was already passing
in Chrome and Firefox.

* LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/inrange-outofrange-expected.txt:
* Source/WebCore/html/DateInputType.cpp:
(WebCore::DateInputType::createStepRange const):
* Source/WebCore/html/DateTimeLocalInputType.cpp:
(WebCore::DateTimeLocalInputType::createStepRange const):
* Source/WebCore/html/MonthInputType.cpp:
(WebCore::MonthInputType::createStepRange const):
* Source/WebCore/html/TimeInputType.cpp:
(WebCore::TimeInputType::createStepRange const):
* Source/WebCore/html/WeekInputType.cpp:
(WebCore::WeekInputType::createStepRange const):

Canonical link: https://commits.webkit.org/311279@main
@webkit-commit-queue webkit-commit-queue force-pushed the 312344_datetime_min_max_check branch from 2c601d3 to f8ae15f Compare April 15, 2026 13:21
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 311279@main (f8ae15f): https://commits.webkit.org/311279@main

Reviewed commits have been landed. Closing PR #62793 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit f8ae15f into WebKit:main Apr 15, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DOM For bugs specific to XML/HTML DOM elements (including parsing).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants