Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#20630 closed Bug (fixed)

HTML5 validation broken by maxlength attributes in number inputs

Reported by: Michael Angeletti Owned by: nobody
Component: Forms Version: master
Severity: Normal Keywords: html5
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The commit for #19686 adds maxlength to number inputs with max digits (

Paste the following into and submit:

<!DOCTYPE html>

        <meta charset="UTF-8">
            <input type="number" maxlength="5">

One of the messages you'll notice is: maxlength when type is text, search, url, tel, e-mail, or password.

So, it appears that HTML5 doesn't allow a maxlength attribute for number inputs.

Attachments (1)

0001-Fixed-20630-Removed-maxlength-attribute-from-NumberI.patch (4.1 KB) - added by Simon Charette 5 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 5 years ago by Simon Charette

Component: UncategorizedForms
Keywords: html5 added
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug
Version: 1.6-alpha-1master

Agreed that we should remove this attribute on number input, I guess we overlooked this :/

I'll write a patch removing this feature and making sure tests don't fail. Should we add a release note concerning this change?

comment:2 Changed 5 years ago by Simon Charette

Has patch: set

Added a patch for review, the only possibly missing part is the release note.

comment:3 Changed 5 years ago by Baptiste Mispelon

Triage Stage: AcceptedReady for checkin

The patch looks good.

7ec2a21be15af5b2c7513482c3bcfdd1e12782ed was committed after the 1.5 release and already includes a release note.
The note makes no mention of maxlength specifically, so I think we're good.

comment:4 Changed 5 years ago by Simon Charette

Great, I'll commit this. I thought we shipped this feature in 1.5, thanks for looking this up!

comment:5 Changed 5 years ago by Simon Charette <charette.s@…>

Resolution: fixed
Status: newclosed

In 04628e2016641bfa657333d6ee1f5b371c17f62c:

Fixed #20630 -- Removed maxlength attribute from NumberInput.

This attribute is only allowed on inputs of type "text", "search", "url",
"tel", "email", or "password".

Thanks to yoyoma for the report and @bmispelon for the review.

comment:6 Changed 5 years ago by Michael Angeletti

Thanks bmispelon and charettes. I'm sorry I didn't make it back in time to offer codereview support. You guys are friggin quick.

Note: See TracTickets for help on using tickets.
Back to Top