Bug 192587 - stepUp/stepDown throw InvalidStateError when number input is empty
Summary: stepUp/stepDown throw InvalidStateError when number input is empty
Status: RESOLVED DUPLICATE of bug 235509
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Safari 12
Hardware: Mac macOS 10.14
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-12-11 06:19 PST by Emanuele Feliziani
Modified: 2022-05-30 17:38 PDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Emanuele Feliziani 2018-12-11 06:19:01 PST
Overview: When an input type=number field is empty, calling stepUp or stepDown on it throws InvalidStateError. Other browsers assume the empty value as 0 and act accordingly.

Steps to Reproduce:

1) Open this test page with only the input field and a button to trigger stepUp: https://7zyy3zrq21.codesandbox.io/ (you can access the editor page for quick tweaking here: https://codesandbox.io/s/7zyy3zrq21)
2) Click on the button

Actual Result: The input field throws InvalidStateError and the value is not changed

Expected Result: The value should be set to 0.01 (assume 0 + step). If a min attribute is set, the value should be set equal to the min attribute. The described behaviour is what happens by clicking on the native UI controls of the input type=number or by using the up/down arrows. 

Additional Information: The expected result is present in both Chrome and Firefox.
Comment 1 Anthony Ricaud 2022-05-30 14:27:54 PDT
I'm not sure when that happened but it seems to be fixed in the Safari Technology Preview 146.
Comment 2 Karl Dubost 2022-05-30 14:58:54 PDT
This might have been fixed by https://bugs.webkit.org/show_bug.cgi?id=235509
Comment 3 Radar WebKit Bug Importer 2022-05-30 14:59:02 PDT
<rdar://problem/94123026>
Comment 4 pascoe@apple.com 2022-05-30 17:38:30 PDT

*** This bug has been marked as a duplicate of bug 235509 ***