[whatwg] Form input element for value-unit pairs

Ian Hickson ian at hixie.ch
Wed May 2 14:56:11 PDT 2012


On Sat, 5 Mar 2011, Christoph Päper wrote:
>
> Imagine a richt text processor done in HTML5. If you want to select the 
> font size (of a template or class, of course) how would you do it?
> 
> Standalone word processors usually have a combo field that lets the user 
> enter a number [...] possibly adding controls for increasng and 
> decreasing [...] or they may allow the user to select one of the 
> predefined recommended or frequent values.

So far, <input type=number> handles these.


> In other places, software interface designers honor the variety of 
> absolute and relative (length) units by introducing a widget that bears 
> the number and the unit symbol, [...] Thus, would it make sense to add 
> another new type for the "input" element?

I think it would make sense to add something like this if we find that 
people do that kind of thing a lot. Currently you can get close using a 
type=number with a <select>; do sites do that?


On Wed, 9 Mar 2011, Diogo Resende wrote:
>
> This is just a numeric input. It has a unit, just like a monetary value, 
> but besides that it's just a number. Maybe a numeric input should have 
> some type of formatting to proper show the unit (prefix/suffix, decimals 
> places, decimal sep., ...).

On Mon, 14 Mar 2011, Christoph Päper wrote:
> 
> A new type is probably not necessary, because a new attribute that is 
> called something like ‘unit’ and is only valid in the ‘number’ and 
> ‘range’ states could be enough.

On Tue, 15 Mar 2011, Diogo Resende wrote:
> 
> For me it would be great that a UA would implement an numberic input 
> with a visible but unchanged unit. Something like an <input>+<span> but 
> the span looking to be inside the input.
>  ________
> [__12_pt_]
>      ^------ cursor would not pass this point
> 
> Extra:
> 
> This is more interesting for other types of input, not necessarily 
> numeric, like IPv4, currencies, HH:MM, ..

That's an interesting idea, but it might be something we should leave to 
the Web Components work.

-- 
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