maxlength attribute should not apply to all input types

RESOLVED FIXED in mozilla2.0b7

Status

()

Core
DOM: Core & HTML
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: Alex, Assigned: mounir)

Tracking

Trunk
mozilla2.0b7
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(blocking2.0 betaN+)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

8 years ago
User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b7pre) Gecko/20100922 Firefox/4.0b7pre
Build Identifier: 

The maxlength attribute applies to <input type="file"> fields, causing them to block the form they are associated with from being submitted.

From the reading the spec, I gather this isn't supposed to happen (it's supposed to be ignored), the documentation on the MDC also says this.

https://developer.mozilla.org/en/HTML/Element/input#attr-maxlength

Reproducible: Always

Steps to Reproduce:
1. Open data:text/html,<input type="file" maxlength="1">
2. Select a random file
3. Notice it gets the red box-shadow specifying it's "invalid"
Actual Results:  
maxlength attribute is ignored, control isn't marked invalid.
(Reporter)

Updated

8 years ago
This needs to block, I think.  Mounir, please fix?
Assignee: nobody → mounir.lamouri
Status: UNCONFIRMED → NEW
blocking2.0: --- → ?
Ever confirmed: true

Updated

8 years ago
blocking2.0: ? → betaN+
(Assignee)

Comment 2

8 years ago
Ok, the problem is maxlength should only apply to some types and we are checking maxlength whatever the type is, which is wrong.
Status: NEW → ASSIGNED
Component: HTML: Form Submission → DOM: Core & HTML
OS: Windows 7 → All
QA Contact: form-submission → general
Hardware: x86 → All
Summary: maxlength attribute applies to file input fields, interacts badly with HTML5 form validation. → maxlength attribute sholud not apply to all input types
Version: unspecified → Trunk
(Assignee)

Comment 3

8 years ago
Created attachment 478437 [details] [diff] [review]
Patch v1

This was also applying to other input types in some cases like:
<input type='text' id='i' maxlength='1'>
<script>
  document.getElementById('i').value = "foo";
  document.getElementById('i').type = "radio";
</script>
Attachment #478437 - Flags: review?(Olli.Pettay)

Updated

8 years ago
Attachment #478437 - Flags: review?(Olli.Pettay) → review+
(Assignee)

Comment 4

8 years ago
Pushed:
http://hg.mozilla.org/mozilla-central/rev/ee041d5c9198
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b8

Updated

8 years ago
Summary: maxlength attribute sholud not apply to all input types → maxlength attribute should not apply to all input types
Target Milestone: mozilla2.0b8 → mozilla2.0b7
You need to log in before you can comment on or make changes to this bug.