From efd6e8639369308715e35532b5f29e3bc399f1ce Mon Sep 17 00:00:00 2001 From: Jerens Lensun <54782057+jerensl@users.noreply.github.com> Date: Mon, 24 Mar 2025 03:16:48 +0800 Subject: [PATCH] fix: radio input element don't trigger validity state (#36103) Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com> --- components/script/dom/htmlinputelement.rs | 6 ++++-- .../forms/constraints/radio-valueMissing.html.ini | 3 --- .../radio-disconnected-group-owner.html.ini | 12 ------------ 3 files changed, 4 insertions(+), 17 deletions(-) delete mode 100644 tests/wpt/meta/html/semantics/forms/constraints/radio-valueMissing.html.ini diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index f2e55e3e91e..e647f19a47d 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -2544,8 +2544,10 @@ impl VirtualMethods for HTMLInputElement { self.upcast::() .check_ancestors_disabled_state_for_form_control(); - self.validity_state() - .perform_validation_and_update(ValidationFlags::all()); + for r in radio_group_iter(self, self.radio_group_name().as_ref()) { + r.validity_state() + .perform_validation_and_update(ValidationFlags::all()); + } } fn unbind_from_tree(&self, context: &UnbindContext) { diff --git a/tests/wpt/meta/html/semantics/forms/constraints/radio-valueMissing.html.ini b/tests/wpt/meta/html/semantics/forms/constraints/radio-valueMissing.html.ini deleted file mode 100644 index 056a42422db..00000000000 --- a/tests/wpt/meta/html/semantics/forms/constraints/radio-valueMissing.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[radio-valueMissing.html] - [One of the radios is required and another one is checked] - expected: FAIL diff --git a/tests/wpt/meta/html/semantics/forms/the-input-element/radio-disconnected-group-owner.html.ini b/tests/wpt/meta/html/semantics/forms/the-input-element/radio-disconnected-group-owner.html.ini index d7d339b1705..7d856ecad7b 100644 --- a/tests/wpt/meta/html/semantics/forms/the-input-element/radio-disconnected-group-owner.html.ini +++ b/tests/wpt/meta/html/semantics/forms/the-input-element/radio-disconnected-group-owner.html.ini @@ -2,17 +2,5 @@ [Removed elements are moved into separate radio groups.] expected: FAIL - [Disconnected radio buttons can serve as radio group containers.] - expected: FAIL - - [Shadow roots in disconnected trees can serve as radio group containers.] - expected: FAIL - - [Non-HTML elements in disconnected trees can serve as radio group containers.] - expected: FAIL - - [Disconnected document fragments can serve as radio group containers.] - expected: FAIL - [Appending input radio input into a disconnect form should update the other radio inputs in the same radio group.] expected: FAIL