Closed Bug 1543477 Opened 6 years ago Closed 6 years ago

zero-sized file input widgets create a lot of scrollable overflow (if you give them overflow:visible)

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: dholbert, Assigned: MatsPalmgren_bugz)

References

Details

Attachments

(3 files)

STR:

  1. Load attached testcase.

EXPECTED RESULTS (from a sites-expecting-Chrome's-behavior standpoint):
4px by 4px box, with the outer 2px being a red outline and the inner 2px being a black border.

ACTUAL RESULTS:
The red outlined area is quite large, and all of the file control content (button and "..." field) are visible.

This is the core webcompat difference between us & Chrome that's in play in bug 1542930.

Attached file testcase 1

Edge 18 gives "EXPECTED RESULTS", btw -- i.e. they match Chrome on this (even before their switch to chromium as the rendering engine).

Safari 12 matches Chrome, too.

So this seems like a case where we're on our own.

Flags: webcompat?

Note that this is not a regression; I can reproduce the issue (large red box) at least as far back as Nightly 2010-12-01 (Firefox 4.0b8pre).

Also, for the record: in Firefox, this seems to be the only <input> type whose rendering changes when given overflow:visible.

Here are two fiddles with every input type listed on MDN (besides hidden), with small content box sizes:

overflow unspecified: http://jsfiddle.net/dholbert/sghn2tz4/embedded/result,css,html
overflow:visible: http://jsfiddle.net/dholbert/sghn2tz4/1/embedded/result,css,html

No longer blocks: 1542930

The HTML spec seems to be in favor of Firefox though, since display:inline-block boxes should overflow when overflow:visible is set.
https://html.spec.whatwg.org/multipage/rendering.html#the-input-element-as-a-file-upload-control

I guess we could add input { overflow: hidden !important; } in the UA sheet if it's necessary for compat.

BTW, overflow: scroll creates scrollbars for several types of form controls (including type=file) in Chrome, although they are non-functional (i.e. you can't actually scroll to make the overflow visible), so I guess that would fix that bug too. :-)
(and for the controls where a scrollbar would make some sense, e.g. type=text, it does nothing. LUL)

It's interesting that adding an explicit overflow: hidden on elements
that implicitly do that internally changes the rendering.
For example, it "broke" layout/reftests/css-grid/grid-item-overflow-stretch-005.html
since overflow give different stretch behavior. That seems like
a bug to me. (There are also some <input type=color> failures
that I haven't looked into.)

The HTML spec says "render as an inline-block box":
https://html.spec.whatwg.org/multipage/rendering.html#widgets
for most form controls AFAICT, and this is also what is proposed in:
https://github.com/whatwg/html/issues/4082

The CSS spec for overflow says it applies to "block containers":
https://drafts.csswg.org/css-overflow-3/#propdef-overflow
which includes inline-block.

I think there's a conflict between these two specs, because
honoring overflow on <input>s wouldn't be web-compatible.

I note however that the AMS definition:
https://drafts.csswg.org/css-grid/#min-size-auto
https://drafts.csswg.org/css-flexbox/#min-size-auto
now uses the phrase "item that is not a scroll container"
which side-steps the issue somewhat (since it's decoupled
from the actual overflow value).

Assignee: nobody → mats
Status: NEW → ASSIGNED
Pushed by mpalmgren@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/8b68648aae2d Make <input type=file> always clip its content. r=dholbert
Flags: in-testsuite+
OS: Unspecified → All
Hardware: Unspecified → All
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Regressions: 1597553
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: