Re: [whatwg] Add <input> "Switch" Type

I was contemplating whether to propose a new input type, or an attribute valid only for checkboxes. But it isn't a checkbox, so I went with a new type value.  You can choose to slide the switch or click it in most OS implementations, so even the behavior is different from a checkbox.

I consider it a different input type the way "range" and "number" are different, despite being semantically identical.


> On Sep 20, 2013, at 6:44 PM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:
> 
>> On Fri, Sep 20, 2013 at 3:36 PM, Brian Blakely <anewpage.media@gmail.com> wrote:
>> "iPhone OS" introduced the switch control (http://i.imgur.com/TA79fo2.png)
>> in 2007.  Since then, there have been many attempts to recreate this on the
>> Web Platform by hacking existing control types and using a lot of
>> meaningless markup, to varying degrees of success.
>> 
>> The proposal is to add a "switch" <input> type.  When it is active, the UA
>> should render a switch control.  It looks like this:
>> 
>> <input type="switch" on />
>> 
>> The "on" attribute indicates whether the switch is in its "on" or "off"
>> state.  There is no "off" attribute, as switches are off by default.  The
>> values corresponding to each state are true and false, respectively.
>> 
>> List of OSs that implement switch controls (likely incomplete):
>> 
>>   - Windows 8
>>   - OS X
>>   - iOS
>>   - Android
>>   - Blackberry OS
>>   - Windows Phone
>> 
>> The major advantage here, as with all controls in HTML, is that the
>> behavior and default appearance of the control is guaranteed to be
>> consistent for a user across the Web, and likely match their host OS as
>> well.  This is sure to be a very attractive and convenient solution for
>> authors.
> 
> This is just a "checkbox" input with different styling, yes?
> 
> ~TJ

Received on Friday, 20 September 2013 23:03:52 UTC