This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 12781 - Allow "maxlength" attribute for number fields
Summary: Allow "maxlength" attribute for number fields
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14222
  Show dependency treegraph
 
Reported: 2011-05-25 16:11 UTC by Ross Nicoll
Modified: 2011-09-22 23:37 UTC (History)
6 users (show)

See Also:


Attachments

Description Ross Nicoll 2011-05-25 16:11:45 UTC
Split from discussion on bug #9670 ( http://www.w3.org/Bugs/Public/show_bug.cgi?id=9670 ):

The "maxlength" attribute is not allowed on number type input fields, as this can be inferred from min, max & step attributes in browsers that understand HTML 5. However, browsers that do not understand HTML 5 still need to know how many characters can be returned to the server, and should use the "maxlength" attribute for this.

Can I suggest that "maxlength" should be allowed, but ignored by HTML 5 compliant browsers?
Comment 1 Aryeh Gregor 2011-06-24 21:27:39 UTC
Hixie has already considered and rejected this idea elsewhere:

"""
During the transition period, I agree that it would be convenient to use 
maxlength="" and size="". And so go ahead and do so.

The useful transition period won't be very long. By the time validators 
have caught up with the new rules, it won't be necessary any more. So in 
the spec, I've just gone ahead and specced the end game.
"""
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-May/031766.html

However, it seems to me that the useful transition period will be a matter of years -- how long until IE9 market share isn't worth worrying about?  On the other hand, validators can be updated very quickly when the spec changes, to the tune of days.

At most, this kind of combination should be obsolete but conforming, like other harmless legacy shims (<a name>, etc.).  Authors should be warned that the attribute will have no effect in browsers that implement the type properly, but IMO they shouldn't be told it's an error.
Comment 2 Michael[tm] Smith 2011-08-04 05:03:43 UTC
mass-moved component to LC1
Comment 3 Ian 'Hixie' Hickson 2011-08-10 23:54:07 UTC
Hm, making it obsolete but conforming with a warning seems ok.

EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with comment 1.
Comment 4 contributor 2011-08-10 23:55:16 UTC
Checked in as WHATWG revision r6413.
Check-in comment: Semi-allow <input type=number maxlength> for legacy reasons.
http://html5.org/tools/web-apps-tracker?from=6412&to=6413
Comment 5 Michael[tm] Smith 2011-08-11 06:49:15 UTC
<MikeSmith> Hixie: I don't understand http://html5.org/r/6413  
<MikeSmith> the spec already states that maxlength on input@type=number is not valid  
<MikeSmith> so validator.nu currently emits an error for it  
<MikeSmith> this change would cause it to emit a warning in addition to an error  
<MikeSmith> unless I'm misunderstanding something  
<MikeSmith> but http://www.whatwg.org/specs/web-apps/current-work/multipage/number-state.html#number-state lists maxlength under "The following content attributes must not be specified and do not apply to the element"  
<MikeSmith> and http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary also indicates that maxlength is now allowed on input@type=number  
<MikeSmith> if the intent is to actually make it conforming but obsolete, it seems like those parts of the spec should be changed as well  
<zcorpan> MikeSmith: "should not" means it's allowed if you have a good reason  
<MikeSmith> OK  
<MikeSmith> but if so, those two parts of the spec should be changed  
<zcorpan> yeah  
<MikeSmith> I don't see how otherwise we can make any changes to the validation behavior
Comment 6 Ian 'Hixie' Hickson 2011-08-15 04:56:42 UTC
Yeah, so basically the problem is that what is conforming and what actually has any effect is, intentionally, tied together here.

So either we should back out r6413 and reject this request, or I guess we can put a temporary "override" requirement on validators here... would that be sufficient, Mike? I don't want to go and fiddle with the WF2 text here because it's a complicated thing to change and this is only temporary anyway.
Comment 7 Michael[tm] Smith 2011-08-15 05:00:06 UTC
(In reply to comment #6)
> Yeah, so basically the problem is that what is conforming and what actually has
> any effect is, intentionally, tied together here.
> 
> So either we should back out r6413 and reject this request, or I guess we can
> put a temporary "override" requirement on validators here... would that be
> sufficient, Mike?

Yeah, that'd be fine by me.
Comment 8 Ian 'Hixie' Hickson 2011-09-22 23:35:58 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Have to actually make this conforming to satisfy the use case, not just discourage it!
Comment 9 contributor 2011-09-22 23:37:05 UTC
Checked in as WHATWG revision r6565.
Check-in comment: Make size and maxlength conforming on type=number for now. (fixing r6413 better)
http://html5.org/tools/web-apps-tracker?from=6564&to=6565