Closed Bug 1621927 Opened 8 months ago Closed 8 months ago

Comma seperated decimals (Czech lenguage) in number inputs stopped working in firefox 74

Categories

(Core :: Layout: Form Controls, defect, P3)

74 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1622221

People

(Reporter: beinhauer.otakar, Unassigned)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:74.0) Gecko/20100101 Firefox/74.0

Steps to reproduce:

I have set lang="cs" on <html>.
I tried to parse number input value ("6,5") with this line of code:

var value = document.querySelector("#input-id").value;
console.log(parseFloat(value));

Actual results:

console returned 6 (of type number).

Expected results:

console.log(parseFloat(value));
should return 6.5 of type number

In prevous versions of firefox it worked properly (tested just now on firefox 73.0.1).

What is worth a note is:

in firefox 74:

console.log(value);
returns 6,5 (of type string)

but in firefox 73:

console.log(value);
returns 6.5 (of type string)

some more details:
1)

temp0.validity.badInput of value "6," returns false
but
temp0.validity.badInput of value "6." returns true


if i send the input with value "6,5"
POST["number"] => "6,5"

.valueAsNumber will do what you want I think, rather than parseFloat, but that being said I'm ~sure this is a behavior change from bug 981248.

I think it's fair to show what the user typed in .value, fwiw, and a few websites relied on that... see bug 1586870 for example, which the change above fixed.

That is, I think FF74's behavior is more sensible over all, specially since you can ask for the raw numeric value using .valueAsNumber...

But that said, I get that sending the normalized / sanitized value in the form data may be useful too, we should consider doing that.

We were planning on maybe getting rid of the localization code as other browsers don't support it... Will think a bit and discuss with people what's the best course of action here.

Blocks: number-input
Status: UNCONFIRMED → NEW
Ever confirmed: true
See Also: → 1605158
Regressed by: 981248

Thank you for the response.
Yes, sending the normalized would be nice.
Even though, I should've sanitized the input on backend myself, I can imagine more applications are dependent on the normalized values being sent. At least now I have an incentive to do so.

Yup, I'll try to take a look to this soonish, though I'm busy with other stuff at this very moment.

Thank you so much for reporting this.

Flags: needinfo?(beinhauer.otakar)

Err, that was supposed to go for me so I don't forget about this ;)

Flags: needinfo?(beinhauer.otakar) → needinfo?(emilio)

I'm going to P3 this given it's kind of an intentional regression and there's a workaround using valueAsNumber.

Priority: -- → P3

This will be fixed in bug 1622221.

Status: NEW → RESOLVED
Closed: 8 months ago
Flags: needinfo?(emilio)
Resolution: --- → DUPLICATE
Duplicate of bug: 1622221
You need to log in before you can comment on or make changes to this bug.