Closed Bug 1836659 Opened 2 years ago Closed 2 years ago

Number input value is empty when trailing dot is present

Categories

(Core :: DOM: Forms, defect)

Firefox 113
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: tuoris.dev, Unassigned)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0

Steps to reproduce:

  1. Add input with type "number"
  2. Add event listener for "input" event to print out input value to console
  3. Focus input then type: "4", ".", "2"

Actual results:

Console output on Firefox 113:
4
<empty string>
4.2

Expected results:

According to Input Number specification (https://www.w3.org/TR/2011/WD-html5-20110525/number-state.html#number-state): "If the value of the element is not a valid floating point number, then set it to the empty string instead.",
but "4." value is valid according to https://www.w3.org/TR/2011/WD-html5-20110525/common-microsyntaxes.html#valid-floating-point-number .

So console output on Firefox should look like this:
4
4
4.2

Chrome output for comparison:
4
4
4.2

The Bugbug bot thinks this bug should belong to the 'Core::DOM: UI Events & Focus Handling' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: UI Events & Focus Handling
Product: Firefox → Core

Example works fine on Firefox 112 and I was able to track it to https://github.com/mozilla/gecko-dev/blob/master/dom/html/HTMLInputElement.cpp#L4590

Keywords: regression
Regressed by: 1821569
Component: DOM: UI Events & Focus Handling → DOM: Forms

When I read step 3 in https://www.w3.org/TR/2011/WD-html5-20110525/common-microsyntaxes.html#valid-floating-point-number it seems to clearly say that a . must be followed by at least one digit.

  • A series of one or more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).

There are tests for this being disallowed that all browsers pass:

http://wpt.live/html/semantics/forms/the-input-element/number.html

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → INVALID
Duplicate of this bug: 1838254
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: