Documentation for the <input type=number> implementation

RESOLVED FIXED

Status

defect
P5
normal
RESOLVED FIXED
6 years ago
2 years ago

People

(Reporter: fscholz, Assigned: teoli)

Tracking

(Blocks 1 bug)

Details

(Whiteboard: u=webdev p=2 c=HTML, URL)

(Reporter)

Description

6 years ago
:: Developer Documentation Request

      Request Type: New Documentation
     Gecko Version: 16 Branch
 Technical Contact: mounir@lamouri.fr

:: Details

In the Firefox 16 branch there is a first implementation of <input type=number>, which we should document. The implementation is not yet complete ( missing UI etc - see bug 344616), but this is a start.

Release notes needed:
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/16

MDN pages probably in need of an update:
https://developer.mozilla.org/en-US/docs/HTML/Element/Input
https://developer.mozilla.org/en-US/docs/DOM/HTMLInputElement

Things that got implemented in Fx16 for now:

New <input type='number'> DOM:
* Bug 635498 - Make <input type='number'> behaves like <input type='text'> 
* Bug 635281 - Implement the value sanitizing algorithm for <input type="number">
* Bug 556009 - Implement step attribute for <input type='number'> 
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#attr-input-step
* Bug 635499 - Implement the max attribute for <input type='number'>
* Bug 635553 - Implement the min attribute for <input type='number'>
* Bug 636627 - Implement stepDown() and stepUp() for <input type='number'> 
(spec/implemention issues Bug 835773 - Align stepUp() and stepDown() implementation to HTML spec)
* Bug 636737 - Implement valueAsNumber for <input type='number'> 

New CSS pseudo-classes:
* Bug 635554 - Implement :in-range and :out-of-range for <input> when the element is suffering from a value overflow/underflow

This got enabled on fennec by default using the "dom.experimental_forms" preference:
Bug 771492 - Enable the dom.experimental forms by default in fennec
(Reporter)

Updated

6 years ago
Whiteboard: u=webdev p=2 c=HTML
(Reporter)

Comment 1

6 years ago
In Firefox 20 the implementation has been updated slightly.

See Bug 813936 - "Update nsHTMLInputElement::GetStepBase() to return the default value if there is no min"

This could have a release note on:
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/20
and the change should be mentioned in the <input type=number> documentation page accordingly.
The implementation status is the following:
- Firefox Android: available by default;
- Firefox OS: available by default;
- Firefox Desktop: disabled by default.

The preference to toggle this feature is "dom.experimental_forms".

Florian, feel free to let me know if you have any question.

Comment 3

5 years ago
Firefox Desktop support is enabled for Firefox 28 unless there are some huge issues blocking.
And I'd be the technical contact if there are any questions.
Blocks: 945309

Comment 5

5 years ago
How we can remove thousand decimal separator that I see on recent version of Nightly (30.0a1 (2014-02-13)) for MediaWiki? http://i.imgur.com/LSW3PbY.png

I can not find that on any documentation.
Whether or not the grouping separator is shown is a decision made by the user agent based on what the user agent's developers think is best for users of a specific locale. (It is not something that should be controllable by content authors.) It's early days with regards to deciding what's best for users of the various locales, so if you think that the users of a specific locale will not want grouping separators shown then please file a bug asking that they not be used for that locale and CC me.

Comment 7

5 years ago
Makes sense to me but as I am not talking about a specific locale so I will ask here, what do you propose for selecting year input on MediaWiki? Migrating away from input type="number"?
Can you point me to a page that shows the year input?
I've spun off bug 974175 for the "year" issue. Let's continue discussion there to avoid spamming this bug with off topic conversation.

Updated

5 years ago
Blocks: 984142

Comment 12

5 years ago
Are these bugs? Don't seem quite right to me:
1. Don't specify step/max/min: field marks any non-integer decimal value as invalid
2. Only 3 digits of precision shown and no way to control this, so if step is 0.0001 you can't see anything happening as you use the arrow controls

See http://jsfiddle.net/6eS26/1/

Comment 13

5 years ago
(In reply to Owen Kaluza from comment #12)
> Are these bugs? Don't seem quite right to me:
> 1. Don't specify step/max/min: field marks any non-integer decimal value as
> invalid
> 2. Only 3 digits of precision shown and no way to control this, so if step
> is 0.0001 you can't see anything happening as you use the arrow controls
> 
> See http://jsfiddle.net/6eS26/1/

Please fill separate bugs for each of those.
(In reply to Owen Kaluza from comment #12)
> Are these bugs? Don't seem quite right to me:
> 1. Don't specify step/max/min: field marks any non-integer decimal value as
> invalid

This is the correct behavior per the spec (the default value is zero, the default step is 1).

> 2. Only 3 digits of precision shown and no way to control this, so if step
> is 0.0001 you can't see anything happening as you use the arrow controls

This is a bug. Please do file this issue and CC me.

Comment 15

5 years ago
(In reply to Jonathan Watt [:jwatt] from comment #14)
> (In reply to Owen Kaluza from comment #12)
> > Are these bugs? Don't seem quite right to me:
> > 1. Don't specify step/max/min: field marks any non-integer decimal value as
> > invalid
> 
> This is the correct behavior per the spec (the default value is zero, the
> default step is 1).

Ah fair enough. I was about to ask if there is a use case of a numeric field without a step, but found it in the spec, setting step="any" seems to solve my problem here.

> > 2. Only 3 digits of precision shown and no way to control this, so if step
> > is 0.0001 you can't see anything happening as you use the arrow controls
> 
> This is a bug. Please do file this issue and CC me.

https://bugzilla.mozilla.org/show_bug.cgi?id=1004327
(Reporter)

Comment 16

2 years ago
This got done https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.