<input type=number> coming to Mozilla

The support for <input type=number> that I've been working on for Mozilla is now turned on for Aurora 28 and Nightly builds. If you're interested in using <input type=number> here are a few things you should know:

  • The current support should first ship in Firefox 28 (scheduled to release in March), barring any issues that would cause us to disable it.
  • As of yet, locale specific user input is not supported. In other words user input that contains non-ASCII digits or a decimal separator other than the decimal point (for example, the comma) will not be accepted. If this turns out to be unacceptable then we may have to turn off support for Firefox 28, or else add a hack to at least accept comma. Ehsan has just finished battling to get ICU integrated into gecko's libXUL, so I should be able to fix this properly for Firefox 29.
  • Unprivileged content is not currently allowed to access the CSS pseudo-elements that would let it style the different internal parts of the element (the text field, spinner and spin buttons). The only direct control content has over the styling of the internals is that it can remove the spinner by setting -moz-appearance:textfield; on the input. (The logic and behavior that defines <input type=number> will still apply, just without those buttons.)

If you test the new support and find any bugs please report them, being sure to add ":jwatt" to the CC field and "<input type=number>" to the Summary field of the report.



Hi, dot as decimal point is quite unacceptable for czech people, they don't understand it, they do not use it and also it's (in czech) a separator for thousands. So as a web-developer, this input would be unusable for common users.

Just to tell you, the coma issue will be problematic in France for the adoption of . (i've seen badly designed application that only allowed the coma...)

You do realise that almost every language other than English uses a comma as decimal separator, right? So only supporting a point is really pointless...

I understand that this support does not yet allow developers who have to cater to an audience that uses non-Arabic digits or non-decimal point to start using <input type=number>. What I'm much more concerned about though (and one reason why I'm blogging so early) is whether there are many existing sites that cater to such an audience that send <input type=number> to Firefox and have been accepting that it has just appeared as a text field. Those sites would likely actually be broken by the new support if non-integral or non-Arabic digit user input is expected. I suspect the likelihood is high that there are sites that do this rather than using a JS library for number input support, but hopefully this blog post will get a more concrete answer to whether that's the case or not, and whether it's common. We can then make a decision about whether we really need to disable the support for now or not.

(For what it's worth (absolutely nothing as far as enable/disable decisions go) the ever reliable Wikipedia claims 'The 42 countries where a dot "." is used to mark the radix point comprise roughly 60% of the world's population': http://en.wikipedia.org/wiki/Decimal_mark .)

Seems that if the spinner is visible and not set to a decimal value, you can only do whole numbers.

So omiting the step field causes an error that wants to round the number to the nearest whole number. Setting the value to .01 as an example allows me to use non-whole numbers.

This is in FF29.

G, this is the behavior defined by the specification, since the default value for the 'step' attribute is 1. You need to set 'step' to an appropriate fractional value or the value 'any'.

Add new comment