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 17630 - Image inputs with no image should fall back to non-replaced elements, just like normal images
Summary: Image inputs with no image should fall back to non-replaced elements, just li...
Status: RESOLVED WORKSFORME
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: 2015 Q1
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-28 14:48 UTC by contributor
Modified: 2013-04-12 22:58 UTC (History)
3 users (show)

See Also:


Attachments

Description contributor 2012-06-28 14:48:23 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html
Multipage: http://www.whatwg.org/C#images
Complete: http://www.whatwg.org/c#images

Comment:
Image inputs with no image should fall back to non-replaced elements, just
like normal images

Posted from: 98.110.194.72 by bzbarsky@mit.edu
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/16.0 Firefox/16.0
Comment 1 Boris Zbarsky 2012-06-28 14:52:20 UTC
And in particular, the text in the spec makes it very likely that the alt text will be cut off.  The difference from normal image behavior seems pretty unnecessary and confusing.
Comment 2 contributor 2012-07-18 17:51:58 UTC
This bug was cloned to create bug 18258 as part of operation convergence.
Comment 3 Ian 'Hixie' Hickson 2012-08-30 19:08:28 UTC
The spec says:

"When an input element whose type attribute is in the Image Button state does not represent an image and the user agent does not expect this to change, the element is expected to be treated as a replaced element consisting of a button whose content is the element's alternative text. The intrinsic dimensions of the button are expected to be about one line in height and whatever width is necessary to render the text on one line."

Why would rendering it as inline text be better? Surely rendering as a button is more appropriate.
Comment 4 Boris Zbarsky 2012-11-30 07:56:50 UTC
It's common for web pages to style image inputs with a width and height.  So while a button is more appropriate if the alt text is short, in practice doing that makes the alt text pretty much useless to the user.  :(
Comment 5 Ian 'Hixie' Hickson 2012-12-30 05:44:24 UTC
The text I quoted doesn't mention the height and width attributes; it explicitly says the text shouldn't be cut off. I don't understand the problem here.
Comment 6 Boris Zbarsky 2012-12-30 06:18:05 UTC
The width and height attributes are mapped into style, so if the object is not a non-replaced inline, they affect the rendered size.  And then your options are overflowing (hence overlapping, hence unreadable) text, or text that's cut off.
Comment 7 Ian 'Hixie' Hickson 2012-12-30 19:34:17 UTC
Ok, I've made height/width not apply in this case. Is that sufficient?
Comment 8 contributor 2012-12-30 19:35:22 UTC
Checked in as WHATWG revision r7614.
Check-in comment: Make width/height attributes not apply to <input type=image src=404> so that the button text doesn't get cut off in the common case.
http://html5.org/tools/web-apps-tracker?from=7613&to=7614
Comment 9 Boris Zbarsky 2012-12-30 20:19:24 UTC
I'll need to think about it.  There are likely to still be issues if the text is wide enough to not fit in the viewport, unfortunately,
Comment 10 Ian 'Hixie' Hickson 2012-12-31 03:40:27 UTC
It's a submit button, a wide label isn't likely to be correct anyway.
Comment 11 Boris Zbarsky 2012-12-31 06:49:27 UTC
That's possible, but I'm not clear on why we want these to have different behavior from <img>, exactly.....
Comment 12 Ian 'Hixie' Hickson 2013-01-01 03:18:21 UTC
Because they're interactive submit buttons, not inline text like <img>.
Comment 13 Boris Zbarsky 2013-01-01 04:22:35 UTC
<img onclick> is an interactive button too...

Basically, the distinction seems arbitrary to me.  Which correspondingly means that implementing anything like this is very low priority, of course.
Comment 14 Ian 'Hixie' Hickson 2013-01-05 02:13:06 UTC
<img onclick> for a button is like <span onclick> for a link or <div onclick> for a button. Not good practice. <img onclick> is more correctly used not as a button, but as a piece of text or image that has some interaction (this is a similar distinction between a link and a button).

Understood about implementation priorities, of course.
Comment 15 Ian 'Hixie' Hickson 2013-04-12 22:58:49 UTC
I'm leaving the spec as-is here, since even though this isn't widely implemented as per the spec, there doesn't seem to be a compat reason _not_ to do it as per the spec, and what the spec suggests seems (slightly) better. So it's one of those things that we'll hope implementors eventually get to, even if it does take a while. (If there's a compat reason not to do this, though, please do reopen.)