WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
207981
input type='number' with maxlength attribute is ignored
https://bugs.webkit.org/show_bug.cgi?id=207981
Summary
input type='number' with maxlength attribute is ignored
karl
Reported
2020-02-19 18:00:46 PST
Created
attachment 391234
[details]
test case for input/number and maxlength Steps to reproduce the problem: 1. Open the test case 2. Type 123 in the input form What is the expected behavior? 12 is displayed What went wrong? 123 is displayed Did this work before? N/A Does this work in other browsers? N/A Safari version: Release 100 (Safari 13.2, WebKit 15610.1.2.1)) Channel: Tech Preview OS Version: OS X 10.15 Flash Version: What is the spec saying
https://html.spec.whatwg.org/multipage/input.html#attr-input-maxlength
> The maxlength attribute, when it applies, is a form control maxlength attribute.
Following
https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-maxlength
> Constraint validation: If an element has a maximum allowed value length, its dirty value flag is true, its value was last changed by a user edit (as opposed to a change made by a script), and the JavaScript string length of the element's API value is greater than the element's maximum allowed value length, then the element is suffering from being too long. > > User agents may prevent the user from causing the element's API value to be set to a value whose JavaScript string length is greater than the element's maximum allowed value length.
It doesn't seem a hard constraint, but ## results for type='number' 1. enter into the url bar ``` data:text/html,<input type='number' maxlength='2'/> ``` 2. type 123 Results in different browsers * firefox: 12 (75.0a1 (2020-02-18) (64-bit)) * chrome: 123 (Version 82.0.4062.4 (Build officiel) canary (64 bits)) * safari: 123 (Release 100 (Safari 13.2, WebKit 15610.1.2.1)) ## results for type='text' ``` data:text/html,<input type='text' maxlength='2'/> ``` Results in different browsers * firefox: 12 (75.0a1 (2020-02-18) (64-bit)) * chrome: 12 (Version 82.0.4062.4 (Build officiel) canary (64 bits)) * safari: 12 (Release 100 (Safari 13.2, WebKit 15610.1.2.1)) This was originally filed as a bug on mozilla bugzilla
https://bugzilla.mozilla.org/show_bug.cgi?id=1616620
Attachments
test case for input/number and maxlength
(323 bytes, text/html)
2020-02-19 18:00 PST
,
karl
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
karl
Comment 1
2020-02-19 18:44:53 PST
tkent commented on the chromium issue.
https://bugs.chromium.org/p/chromium/issues/detail?id=1054251#c2
https://html.spec.whatwg.org/multipage/input.html#number-state-(type=number
)
> The following content attributes must not be specified and do not apply to the element: accept, alt, checked, dirname, formaction, formenctype, formmethod, formnovalidate, formtarget, height, maxlength, minlength, multiple, pattern, size, src, and width.
So probably webkit is fine. and firefox needs to fix it.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug