This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17818 - ":required" pseudo selector for a radio button group
Summary: ":required" pseudo selector for a radio button group
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-18 06:54 UTC by contributor
Modified: 2012-09-26 04:00 UTC (History)
5 users (show)

See Also:


Attachments

Description contributor 2012-07-18 06:54:40 UTC
This was was cloned from bug 15703 as part of operation convergence.
Originally filed: 2012-01-25 03:13:00 +0000
Original reporter: Kent Tamura <tkent@chromium.org>

================================================================================
 #0   Kent Tamura                                     2012-01-25 03:13:12 +0000 
--------------------------------------------------------------------------------
http://dev.w3.org/html5/spec/Overview.html#selector-required
> :required
>   The :required pseudo-class must match any element falling into one of the following categories:
>    - input elements that are required

According to this definition, radio1 in the following example is not matched to ":required" though radio1 is invalid.  I think it's inconsistent and we had better add an exceptional rule for radio button groups.

<form>
<input type=radio name=group1 id=radio1>
<input type=radio name=group1 required>
</form>
================================================================================
 #1   Marat Tanalin | tanalin.com                     2012-01-25 11:27:41 +0000 
--------------------------------------------------------------------------------
By the way, radio buttons is a case where having @required attribute for fieldset would be handy:

<fieldset required>
	<input type="radio" name="group1" id="radio1" />
	<input type="radio" name="group1" />
</fieldset>

So we could use FIELDSET:required instead of INPUT:required.
================================================================================
Comment 1 Ian 'Hixie' Hickson 2012-09-26 04:00:42 UTC
This would require "spooky action at a distance" in selectors. I think if you want :required to match, it's reasonable to require you to set the attribute also.