W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2011

[whatwg] Decimal comma in numeric input

From: Aryeh Gregor <Simetrical+w3c@gmail.com>
Date: Sun, 17 Apr 2011 17:00:16 -0400
Message-ID: <BANLkTinkFjcV+kt1QRp0dTX1wRqTaUQNTA@mail.gmail.com>
On Sat, Apr 16, 2011 at 9:18 AM, Jukka K. Korpela <jkorpela at cs.tut.fi> wrote:
> An element for user input of a real number in a format that uses a suitable
> decimal separator is hardly a "specific need".

It's more specific than just an element for user input of a number.
We don't even have that implemented well across browsers yet.  The
current specification is perfectly sufficient for many use-cases -- at
a minimum, English-language sites.  If there's author demand for
control over decimal separators, a new CSS property is probably the
right way to do it, which should affect all in-page browser-generated
numbers (supposing there are any other than <input type=number>).

But I don't know if there's going to be implementer interest at this
stage, before they've even gotten a basic implementation of all the
existing input types.  In Firefox 4.0, for instance, date inputs don't
work at all.  I'd be surprised if they prioritized adding new features
to number inputs before they've got any date inputs at all.

> This is not about "more features". This is about the implementations, and
> implementability, of the feature <input type="number">.

Something that allows the author to specify what decimal separator is
used would certainly be "more features".  It would be another thing
for UAs to implement and converge on, which takes time and resources
that could be devoted to other things.

> Is rather about "less features". Maybe <input type="number"> should be
> restricted to integer input only, on the ground that useful features with
> fairly straightforward implementability should be added, without waiting for
> clarification of issues related possible extended formats of the features.
>
> It might even be a good idea to add an element for real number input later
> as, say, <input type="real"> rather than allowing <input type="number"> to
> accept real numbers. This would allow e.g. an implementation to provide a
> virtual keyboard for <input type="number"> with only digits, "+" sign, and
> "-" sign, making it clearer that only whole numbers are expected.

<input type=number> accepts only integers by default.  If you want it
to accept non-integers, you have to specify the step attribute.  step,
min, and max should be enough to allow implementers to provide good UI
-- there's no need for a separate type.

(I'll add as someone whose academic background is more mathematics
than computers: could we please not write standards that call
floating-point numbers "reals"?  "float" is the more common term
anyway, and it doesn't conflict with terminology that long predated
computers.)
Received on Sunday, 17 April 2011 14:00:16 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:03 GMT