Closed Bug 1428553 Opened 7 years ago Closed 7 years ago

Add thousand-separator for numbers in number-input-fields

Categories

(Core :: Layout: Form Controls, enhancement)

57 Branch
enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1214114

People

(Reporter: gabriel, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0.2 Safari/604.4.7 Steps to reproduce: if you set the number value of a number-input field, it should show a separator on thousands. It could be a locale dependent one (12,345.67 / 12.345,67) or independent on locale it could be a space (12 345.67 / 12 345,67) or maybe even better, it could be achieved using higher kern value (between 2 and 3 in the example above) so that there is no extra character (on setting, getting, copying, parsing and so on).
(In reply to Gabriel Gritsch from comment #0) > if you set the number value of a number-input field, it should show a > separator on thousands. Not necessarily; consider e.g. a "year" field. "1,998" looks pretty broken as the year 1998. Looks like this has been filed before as bug 1214114, and as noted there, the current behavior is intentional per bug 974175.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
[:dholbert] Would it make sense to enable this using an attribute or using CSS because large numbers are nearly unreadable (and that drops the sense of a number-field if you can not use it for large numbers...)
Maybe! I don't really know anything about the details here, beyond having done a bugzilla search to discover that this has been filed before (as part of new-bug triage). Anyway -- the grouping behavior here would be a decision for the WHATWG (the standards body) -- and from skimming bug 974175, it looks like they've had some mailing-list discussions about it, and jwatt (our implementor for this feature) went back and forth before deciding on our current behavior. I'd suggest reading the comments on that bug, and the mailing list discussion that he started on the topic, which is here: https://lists.w3.org/Archives/Public/public-whatwg-archive/2014Feb/0075.html (I'm not sure whether the optional-attribute came up during that conversation, but I'll bet that it did.)
Yeah, it looks like the attribute/property possibility did come up in that discussion, and was frowned upon, since authors' expectations about which-numbers-get-grouping-separators may differ from their users' expectations, due to locale differences etc. See in particular: https://lists.w3.org/Archives/Public/public-whatwg-archive/2014Feb/0085.html https://lists.w3.org/Archives/Public/public-whatwg-archive/2014Feb/0092.html https://lists.w3.org/Archives/Public/public-whatwg-archive/2014Feb/0097.html (I didn't follow the discussion all the way to the end, though -- I'm just paraphrasing the piece I found that's relevant to your question.)
Thank you for the links, I still think that it should be possible to group the numbers (maybe using kerning to prevent issues with other separators) but if a decision was done, I think there is no way around it ;-)

How about a an attribute called something like numberformat or inputformat which could be used in conjunction with https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat

Maybe something like this: <input type="number" inputformat="'ja-JP', { style: 'currency', currency: 'JPY' })">

Same kind of thing I was talking about here for the datetime control: https://bugzilla.mozilla.org/show_bug.cgi?id=1432575

You need to log in before you can comment on or make changes to this bug.