[whatwg] Make radio button group suffering from being missing

Ian Hickson ian at hixie.ch
Fri Jan 7 14:06:28 PST 2011


On Thu, 4 Nov 2010, Mounir Lamouri wrote:
> 
> Currently, when a radio button is required, it will suffer from being
> missing if no radio elements in the radio button group is checked.
> However, radio elements in the group will not suffer from being missing
> if they do not have the required attribute. In other words, if you try
> to style invalid elements with :invalid, and do:
> <input type='radio' name='s' value='M' required>
> <input type='radio' name='s' value='F'>
> only the first element will be styled.
> 
> I think we should move the requirement to the radio button group that
> way: "The radio button group suffers from being missing if one of the
> input elements in the radio button group is required and all of them
> have a checkedness that is false." and radio elements would have this
> constraint: "If the radio button group is suffering from being missing,
> the element is suffering from being missing.".
> 
> That way, all radio elements in the same radio button group will have
> the same validity state. That would be less annoying for authors and
> error proof while making things clearer (IMO).

The basic idea behind this design is that type=radio seems to have been 
designed to keep each control as independent as possible -- before we 
started fiddling with it in WF2, the only way type=radio controls had any 
relationship to other type=radio controls was with their behaviour when 
they were clicked. Now, for required="", we needed a little more than 
that, because otherwise required="" was essentially useless for radio 
buttons, but I tried to be faithful to the original design and kept it as 
independent as possible.


> I'm thinking of implementing that for Gecko 2.0/Firefox 4 so I would 
> like to know if you know any reason that would make the current behavior 
> more appropriate than the one described here.

In the end I'll spec whatever gets implemented. What do other browser 
vendors feel about this? Should we make required="" on any one type=radio 
control affect the validity of all the other controls? Or should we stick 
to the independent basis of this API?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list