Open Bug 1445898 Opened 6 years ago Updated 2 years ago

<select size="01"> is styled as a listbox, not a combobox

Categories

(Core :: Layout: Form Controls, defect, P3)

39 Branch
Unspecified
Windows 10
defect

Tracking

()

Tracking Status
firefox-esr52 --- wontfix
firefox-esr60 --- wontfix
firefox59 --- wontfix
firefox60 --- wontfix
firefox61 --- fix-optional

People

(Reporter: alessiofirrincieli, Unassigned)

References

()

Details

(Keywords: regression)

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:59.0) Gecko/20100101 Firefox/59.0
Build ID: 20180310025718
Firefox for Android

Steps to reproduce:

The  size Attribute for <select>   does not work if set to 01 but if set to 1,02,03 works.


Actual results:

If 01 is set, the Size attribute does not work and the element's arrow is not displayed


Expected results:

the value 01 should be accepted and the down arrow must be visible if size = "01" is set
OS: Unspecified → Windows 10
Priority: -- → P4
Not a security issue.
Group: firefox-core-security
Component: Untriaged → General
Priority: P4 → P1
Component: General → Layout: Form Controls
Priority: P1 → --
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
That doesn't seem like the right regression range.  The dropdown arrow
is missing and the background is white rather than grey in earlier
versions too (at least on Linux which I'm testing).

The real regression seems to have occurred between Firefox 38 and 39.
Loading "data:text/html,<select size="01"><option>1" in FF38 and selecting the <select>
element in the devtools window shows size="1" and this rule from our UA sheets match:
https://searchfox.org/mozilla-central/rev/6e96a3f1e44e286ddae5fdafab737709741d237a/layout/style/res/forms.css#278
In FF39 however, I see size="01" and that rule no longer matches, and we match this instead:
https://searchfox.org/mozilla-central/rev/6e96a3f1e44e286ddae5fdafab737709741d237a/layout/style/res/forms.css#263
So I'm guessing something about the size attribute changed between 38 and 39.

Anyway, arguably it's the UA rules that are wrong since only "0" and "1"
gives us -moz-appearance:menulist.  All other size values gives us
-moz-appearance:listbox which I suspect isn't how we actually handle the size
value internally.  I think valid integers larger than 1 results in a list
control, and everything else a combobox control.  So we're styling the latter
wrongly unless the value is literally "0" or "1" (or no @size was given).
(nsCSSFrameConstructor is using HTMLSelectElement::IsCombobox() to decide
which type of box to create)

I'm not sure how we can make the selectors match that.
I don't think there is a [size=valid_integer_larger_than(1)] selector.
I guess we could try something like [size^="2"], [size^="3"], ...
Let's see what Try says:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=a54957e1a177082abba23b3439bcd46bdcceb5d5
No longer blocks: 1246836
Summary: Size in a SelectTag → <select size="01"> is styled as a listbox, not a combobox
Regression window for linux:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=11506aaf7064&tochange=9dbb2d41bb2c

Suspect:
	83ac7b782760	Boris Zbarsky — Bug 1142478. Fix integer attribute parsing to not lose track of leading zeroes. r=sicking
Blocks: 1142478
(In reply to Mats Palmgren (:mats) from comment #3)
> I guess we could try something like [size^="2"], [size^="3"], ...
> Let's see what Try says:
> https://treeherder.mozilla.org/#/
> jobs?repo=try&revision=a54957e1a177082abba23b3439bcd46bdcceb5d5

What you do in https://hg.mozilla.org/try/rev/de83efd872d2ede7f0ed4eded3460af6bb292a54 still doesn't handle size="02" or size="011" correctly, or a few other similar cases.  It seems like this just trades off handling leading zeroes incorrectly for one set of cases with handling leading zeroes incorrectly for another.  It also seems likely to be slower.
Though I suppose it might work if you did *= rather than ^=, at least for all the cases that are valid integers.  But how does the spec say things that aren't valid integers should be handled?
Hmm, I guess so.  It would be great if @type actually reflected the actual
type of control, but it doesn't. :(
https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-type

> But how does the spec say things that aren't valid integers should be handled?

https://html.spec.whatwg.org/multipage/form-elements.html#concept-select-size
4 if @multiple is present, 1 otherwise.
Any update on this?
Flags: needinfo?(mreavy)
This was mislabeled.  It's not a new regression -- it's an old one going back to Fx 39.  No one is currently working it.
Has Regression Range: --- → yes
Flags: needinfo?(mreavy)
Priority: -- → P3
Version: 59 Branch → 39 Branch
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.