<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>207981</bug_id>
          
          <creation_ts>2020-02-19 18:00:46 -0800</creation_ts>
          <short_desc>input type=&apos;number&apos; with maxlength attribute is ignored</short_desc>
          <delta_ts>2020-02-19 18:45:19 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Forms</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="karl">karl+webkit</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>cdumez</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1620989</commentid>
    <comment_count>0</comment_count>
      <attachid>391234</attachid>
    <who name="karl">karl+webkit</who>
    <bug_when>2020-02-19 18:00:46 -0800</bug_when>
    <thetext>Created attachment 391234
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

&gt; 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

&gt; 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&apos;s API value is greater than the element&apos;s maximum allowed value length, then the element is suffering from being too long.
&gt; 
&gt; User agents may prevent the user from causing the element&apos;s API value to be set to a value whose JavaScript string length is greater than the element&apos;s maximum allowed value length.

It doesn&apos;t seem a hard constraint, but

## results for type=&apos;number&apos;

1. enter into the url bar
```
data:text/html,&lt;input type=&apos;number&apos; maxlength=&apos;2&apos;/&gt;
```
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=&apos;text&apos;

```
data:text/html,&lt;input type=&apos;text&apos; maxlength=&apos;2&apos;/&gt;
```
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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1621014</commentid>
    <comment_count>1</comment_count>
    <who name="karl">karl+webkit</who>
    <bug_when>2020-02-19 18:44:53 -0800</bug_when>
    <thetext>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)

&gt; 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.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>391234</attachid>
            <date>2020-02-19 18:00:46 -0800</date>
            <delta_ts>2020-02-19 18:00:46 -0800</delta_ts>
            <desc>test case for input/number and maxlength</desc>
            <filename>input-test.html</filename>
            <type>text/html</type>
            <size>323</size>
            <attacher name="karl">karl+webkit</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KPGhlYWQ+CiAgICA8bWV0YSBjaGFyc2V0
PSJVVEYtOCI+CiAgICA8bWV0YSBuYW1lPSJ2aWV3cG9ydCIgY29udGVudD0id2lkdGg9ZGV2aWNl
LXdpZHRoLCBpbml0aWFsLXNjYWxlPTEuMCI+CiAgICA8dGl0bGU+dGVzdGluZyBpbnB1dCB0eXBl
IG51bWJlciBtYXhsZW5ndGg8L3RpdGxlPgo8L2hlYWQ+Cjxib2R5Pgo8cD5wbGVhc2UgdHlwZSAx
MjMsIG9ubHkgMTIgc2hvdWxkIGJlIGRpc3BsYXllZC48L3A+CgogICAgPGlucHV0IHR5cGU9J251
bWJlcicgbWF4bGVuZ3RoPScyJy8+Cgo8L2JvZHk+CjwvaHRtbD4=
</data>

          </attachment>
      

    </bug>

</bugzilla>