[whatwg] <input type=number> without keyboard editing

Boris Zbarsky bzbarsky at MIT.EDU
Tue Nov 2 18:58:07 PDT 2010


On 11/2/10 3:57 PM, Aryeh Gregor wrote:
> If the user enters a value of 100 in<input type=number max=50>, then
> it seems perverse to tell them "The maximum allowed value is 50" so
> they have to go back and fix it.  It makes more sense to just
> automatically clamp it to 50.  Unless the user happens to be
> submitting the form before unfocusing the input, they'll see that it
> got clamped and can fix it if that's wrong, but in practical cases it
> should almost always be right to clamp out-of-range input, and to
> round input that doesn't match the step.  (If the author doesn't like
> it in some particular case, they can use a simple event handler
> instead of max="".)

This is difficult to do in practice.  Consider:

  <input type="number" min="20" max="50" value="20">

The user now wishes to input 30 instead of the default value of 20. 
What steps need to be taken to do this, and how does the input control 
react to those steps?

I agree that things are simpler if only one of min and max is specified.

-Boris



More information about the whatwg mailing list