Closed Bug 1197113 Opened 9 years ago Closed 7 years ago

<input type=number> with step 0.01 treats "." as a grouping separator instead of the decimal separator

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: enclave.pevik, Unassigned)

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0
Build ID: 20150819004006

Steps to reproduce:

"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0"
Developer Edition

I've created input as follows inside of the form:
<input type="number" min="0.01" max="9999999999999.99" step="0.01" />


Actual results:

I console.log the value in javascript on form submission. Here are the results:
When I type in "1.23" or "1,23" -> OK, results in 1.23 string value, BUT:
When I type in "1.234" -> I got value of "1234" in console! [ERROR]
When I type in "1,234" -> validation works and FireFox won't allow me to send the form.
When I type in "1.2345" or "1,2345"-> validation works and FireFox won't allow me to send the form.


Expected results:

1) FireFox shouldn't convert the value from 1.234 to 1234
2) FireFox shouldn't allow me to type in 1.234 because of the "step" attribute
Component: HTML: Form Submission → DOM: Core & HTML
What is your locale? (If you go to the URL about:config then what is the value of the general.useragent.locale pref?)
It's set to en-US
Attached file testcase (obsolete) —
Attachment #8661603 - Attachment mime type: text/plain → text/html
Attached file testcase
Attachment #8661603 - Attachment is obsolete: true
Attachment #8661605 - Attachment mime type: text/plain → text/html
And what does the attached testcase alert for you?
Summary: input number with step 0.01 ignores dot sign when there are 3 digits after the dot → <input type=number> with step 0.01 treats "." as a grouping separator instead of the decimal separator
I'm very sorry for my huge mistake. Everything (discussed in this report) WFM as expected on russian and english localizations of Aurora. I mixed it up with bug 1208923 I just reported.

I agree that the reporter obviously encountered this on a page with   [lang="{comma-language}"]   since "1,23" and "1.23" both passed the validation.
Status: NEW → UNCONFIRMED
Ever confirmed: false
Flags: needinfo?(jwatt) → needinfo?(enclave.pevik)
(In reply to Jonathan Watt [:jwatt] from comment #5)
> And what does the attached testcase alert for you?

Now it works when I type 1.234 (alerts 1.234), but when i type in 1,234 it alerts 1234. So it looks like language-specific problem.

I don't think this should be language-specific, since "." and "," are both valid decimal separators in many countries. I've never read the input specs by Consortium, but I thought that defining input as number both "." and "," should be valid decimal separator chars.
Flags: needinfo?(enclave.pevik)
(In reply to enclave.pevik from comment #8)
> (In reply to Jonathan Watt [:jwatt] from comment #5)
> > And what does the attached testcase alert for you?
> 
> Now it works when I type 1.234 (alerts 1.234), but when i type in 1,234 it
> alerts 1234. So it looks like language-specific problem.

The lang="en" on the <input> is expected to behave in exactly this way. In English, "." is the decimal separator, while "," is the thousands separator.

> I don't think this should be language-specific, since "." and "," are both
> valid decimal separators in many countries.

Which countries? In the locales that I'm aware of one is the decimal and one is the thousands separator. I'm not aware of a locale in which *both* are interchangeably usable as the *decimal* separator. I'm no expert on this though, hence the question.
Marking "INCOMPLETE" pending a reply to my question in comment 9. Otherwise this seems to be invalid.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: