[whatwg] Default Radio Buttons

Ian Hickson wrote:
> On Wed, 8 Dec 2004, Matthew Raymond wrote:
>>   Oh, I agree that for backwards compatibility sake, we need to support 
>>radio groups with no initial values. However, I see little reason not to 
>>recommend default radio buttons in either WF2 or WA1. (Probably the 
>>former.)
> 
> You mean give a suggestion to authors? The spec already says "Authors are 
> recommended to always have one radio button selected. Having no radio 
> buttons selected, or more than one in a group selected, is considered very 
> poor UI." but I don't know what else we can do.


    Oops! Need to read the draft spec more often.

>>   That said, I really wish there were a way to [deprecate] the lack of 
>>a default, but the method of doing so escapes me at the moment.
> 
> Yeah, I don't really know how we could do that either.

    I already have a good sense of why it's so hard to come up with a 
solution for this, but let's give it a shot anyway. After all, a good 
engineer needs to document what won't work, because you never know when 
a client/manager/other person might ask you why you didn't take a 
specific approach.

Solution #1 - New elements:

    Well, one thing we could do is to replace existing <input> types 
with  straight elements:

<textbox value="Text"/>
<radio value="true"/>
<checkbox checked="true"/><!-- Please don't sue me, Mozilla Team! -->
<range min="0" max="10" value="5"/>
<etc/>

    Using elements like these would require less markup, make the code 
more readable, and allow us to apply whatever rules we want because the 
markup is brand new. The problem is that we end up creating a dumbed 
down version of XForms without actually creating new functionality. Not 
to mention the fact that we drastically increase the amount of markup 
people have to learn.

Solution #2 - Metadata Switch:

    We could create a switch in the <meta> element to turn enforcement 
of default radio buttons on and off:

| <meta name="default_radio_button" content="on"/>

    There are several problems with this. First, what's the default if 
people don't include the flag? Second, if you have the default of this 
meta flag as being "on", you can only use the flag with HTML5 documents, 
meaning you have to detect the document type and worry about the 
transfer of legacy code into HTML5 documents.

Received on Thursday, 9 December 2004 07:23:45 UTC