Closed Bug 1800077 Opened 2 years ago Closed 4 months ago

text-overflow: ellipsis doesn't work on input buttons despite overflow being visually clipped

Categories

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

Firefox 106
defect

Tracking

()

RESOLVED FIXED
123 Branch
Tracking Status
firefox123 --- fixed

People

(Reporter: samuel, Assigned: emilio)

References

Details

Attachments

(4 files, 2 obsolete files)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36

Steps to reproduce:

  1. Create a <input type="button"> (submit or reset also works the same way)

  2. Set text-overflow: ellipsis and constrain the width of the button to, for example, 200px (style="text-overflow: ellipsis; width: 200px;").

  3. Set the value of the button to something that makes the text longer than 200px (value="verylongtextverylongtextverylongtextverylongtext").

Actual results:

The text is clipped without ellipsis being shown.

Expected results:

Since the text is clipped, precisely like when “overflow: hidden” or “overflow: clip” is set, I expect “text-overflow: ellipsis” to work.

Setting "overflow: hidden" or "overflow: clip" are possible workarounds.

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core
Priority: -- → P3

Note that the screenshot in attachment 9302844 [details] is with the workaround of "overflow: hidden" applied.

Attachment #9302844 - Attachment description: text_overflow_bug.png → text_overflow_with_workaround.png
Attached image text_overflow_bug.png

Screenshot of the bug

Attached file Test-case (obsolete) —

I'm not sure this is really a bug, text-overflow works only on scroll containers, and buttons aren't one unless you use overflow: {auto,hidden,scroll}.

Component: Widget: Gtk → Layout: Form Controls

Err, nevermind, it does work with overflow: clip.

Attachment #9366813 - Attachment is obsolete: true
Attachment #9366815 - Attachment mime type: text/plain → text/html

So this is because we unconditionally clip in here for <input>.

My preference would be to instead have input[type=button] { overflow: clip !important } on the UA stylesheet instead.

This implements the proposal in:

https://github.com/whatwg/html/issues/9976

Will wait till that is settled to land this.

Assignee: nobody → emilio
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Severity: -- → S3
Flags: needinfo?(emilio)

The spec says scroll container, so overflow: visible and clip shouldn't
be different. Without this fix the other patch causes a failure in
grid-item-overflow-stretch-005.html.

As noted in the comments, we should probably not look at the computed
value but the box type instead, but that's probably worth fixing in a
separate bug.

Depends on D195419

Flags: needinfo?(emilio)
Blocks: 1871412

Comment on attachment 9369826 [details]
Bug 1800077 - Make grid not look at overflow: visible explicitly to make stretching decisions. r=#layout,dholbert,tylin

Revision D197052 was moved to bug 1871412. Setting attachment 9369826 [details] to obsolete.

Attachment #9369826 - Attachment is obsolete: true
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/autoland/rev/1fb09caf9d62
Make <input type=button> magic clip not magic. r=jwatt,zcorpan
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/43768 for changes under testing/web-platform/tests

Backed out for causing build bustages in nsHTMLButtonControlFrame.cpp

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: /builds/worker/checkouts/gecko/layout/forms/nsHTMLButtonControlFrame.cpp(127,14): error: incomplete type 'nsLayoutUtils' named in nested name specifier
Flags: needinfo?(emilio)
Upstream PR was closed without merging
Attachment #9366817 - Attachment description: Bug 1800077 - Make <input type=button> magic clip not magic. r=#layout → Bug 1800077 - Make <input type=button> magic clip not magic. r=jwatt,zcorpan
Flags: needinfo?(emilio)
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/autoland/rev/6a14f6032898
Make <input type=button> magic clip not magic. r=jwatt,zcorpan
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/autoland/rev/557afe23615f
Add a missing include to fix non-unified builds.
Pushed by ctuns@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5d3495a225cd
Annotate a test that now passes on Linux
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/autoland/rev/70f0875a4aa2
Tweak fuzzy annotation of input color text which is fuzzy by one more pixel now.
Upstream PR merged by moz-wptsync-bot
Regressions: 1872006
Regressions: 1872509
Regressions: 1882139
Regressions: 1882805
Regressions: 1886067
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: