MozillaZine

Size attribute ignored when type is number!

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
CharlesEF
 
Posts: 146
Joined: November 21st, 2003, 4:56 am
Location: Edinburg, Texas

Post Posted March 29th, 2018, 4:15 pm

Hi All,

I have the current version of Firefox installed on Win10 Pro 64-bit. I have found that when using an input element of the number type the size attribute is ignored. Bug?


Thanks for any help,

Charles

Frenzie

User avatar
 
Posts: 2134
Joined: May 5th, 2004, 10:40 am
Location: Belgium

Post Posted March 30th, 2018, 2:37 am

Minimal test case?
Intelligent alien life does exist, otherwise they would have contacted us.

CharlesEF
 
Posts: 146
Joined: November 21st, 2003, 4:56 am
Location: Edinburg, Texas

Post Posted March 30th, 2018, 3:41 pm


morat
 
Posts: 2824
Joined: February 3rd, 2009, 6:29 pm

Post Posted March 30th, 2018, 4:05 pm

HTML input type “number” won't resize
http://stackoverflow.com/questions/22709792

HTML <input> size Attribute
http://www.w3schools.com/tags/att_input_size.asp

CharlesEF
 
Posts: 146
Joined: November 21st, 2003, 4:56 am
Location: Edinburg, Texas

Post Posted March 30th, 2018, 7:30 pm

Oh, since other browsers support the re-size but Firefox doesn't I have to use CSS instead. I mean, even IE 11 and Edge support this but Firefox doesn't!

Frenzie

User avatar
 
Posts: 2134
Joined: May 5th, 2004, 10:40 am
Location: Belgium

Post Posted March 31st, 2018, 12:40 am

https://www.w3.org/TR/html5/obsolete.html#obsolete
Authors should not, but may despite requirements to the contrary elsewhere in this specification, specify the maxlength and size attributes on input elements whose type attributes are in the Number state. One valid reason for using these attributes regardless is to help legacy user agents that do not support input elements with type="number" to still render the text control with a useful width.


I'm not entirely sure I understand the rationale. Size is something different than min/max (or its regular input equivalent maxlength). Presumably it has something to do with this:

https://www.w3.org/TR/html5/sec-forms.h ... typenumber
The type=number state is not appropriate for input that happens to only consist of numbers but isn’t strictly speaking a number. For example, it would be inappropriate for credit card numbers or US postal codes. A simple way of determining whether to use type=number is to consider whether it would make sense for the input control to have a spinbox interface (e.g., with "up" and "down" arrows). Getting a credit card number wrong by 1 in the last digit isn’t a minor mistake, it’s as wrong as getting every digit incorrect. So it would not make sense for the user to select a credit card number using "up" and "down" buttons. When a spinbox interface is not appropriate, type=text is probably the right choice (possibly with a pattern attribute).


CharlesEF wrote:Oh, since other browsers support the re-size but Firefox doesn't I have to use CSS instead. I mean, even IE 11 and Edge support this but Firefox doesn't!

Chromia and WebKits seem to behave the same as Firefox so "other browsers" really just means one browser. ;)

(Edge is IE12 no matter what they call it.)
Intelligent alien life does exist, otherwise they would have contacted us.

Return to Web Development / Standards Evangelism


Who is online

Users browsing this forum: No registered users and 2 guests