[whatwg] typeMismatch for type=number (Re: Input color state: type mismatch)

On Fri, 23 Jul 2010, TAMURA, Kent wrote:
> On Sat, Apr 3, 2010 at 06:37, Ian Hickson <ian at hixie.ch> wrote:
> > On Sat, 3 Apr 2010, TAMURA, Kent wrote:
> > > 
> > > I found type=number also had no typeMismatch. If a user wants to 
> > > type a negative value, he types '-' first.  This state should make 
> > > typeMismatch true because '-' is not a valid floating point number.
> > 
> > The user agent shouldn't update the value until the input is a valid 
> > number. ("User agents must not allow the user to set the value to a 
> > string that is not a valid floating point number.")
> 
> I don't accept this behavior.  Suppose that a user type "-" to an empty 
> <input type=number>, then press ENTER to submit the form. As per the 
> current specification, UA should send an empty value for the number 
> control even though the number control has a visible string.  The user 
> doesn't expect a value different from the visible value is sent.  This 
> is very confusing.
>
> In such case, UA should prevent the form submission and show a 
> validation message for typeCheck.

I would expect hitting enter in such a scenario to do something like 
change the display so that the "-" is replaced by a zero. This is similar 
to, e.g., how when you type in "-" as the port in the Mac OS X Network 
configuration panel's Proxy tab and then hit OK, it just gets dropped with 
comment, or how when you put in a bogus IP address as a DNS entry and hit 
OK, it beeps and removes the entry. Firefox's "Offline Storage" numeric 
entry edit box and the edit boxes for proxy port numbers are similar -- 
they won't let you enter an invalid value.

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

Received on Wednesday, 11 August 2010 18:26:16 UTC