Closed Bug 1616537 Opened 2 months ago Closed 1 month ago

img broken shown even with alt=""

Categories

(Core :: Layout: Images, Video, and HTML Frames, defect, P3)

73 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox-esr68 --- wontfix
firefox73 --- wontfix
firefox74 --- wontfix
firefox75 --- fixed

People

(Reporter: benjamin.leseur, Assigned: emilio)

References

(Regression)

Details

(Keywords: parity-chrome, regression)

Attachments

(3 files)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0

Steps to reproduce:

A web page with a non-important image like :

<img src="non-existing.jpg" alt="">

The broken image icon is shown even with the alt attribute set to "".

Actual results:

Firefox shows the broken image icon.

Expected results:

The broken image icon should be hidden.

Reading the doc : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img I found this in alt paragraph :

Setting this attribute to an empty string (alt="") indicates that this image is not a key part of the content (it’s decoration or a tracking pixel), and that non-visual browsers may omit it from rendering.
Visual browsers will also hide the broken image icon if the alt is empty and the image failed to display.

Chromium hide the broken image icon with alt=""

Has STR: --- → yes
Component: Untriaged → Layout: Images, Video, and HTML Frames
Keywords: parity-chrome
Product: Firefox → Core

I don't see any broken image icon with data:text/html,<!doctype html><img src="non-existing.jpg" width=50 height=50 alt=""> or the same without the standards mode or the width / height attributes or what not.

Can you attach a test-case that reproduces the issue?

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0
20200219095352

(In reply to Emilio Cobos Álvarez (:emilio) from comment #1)

Can you attach a test-case that reproduces the issue?

I don't see a broken image with your example either, but I do with this one:
data:text/html,<!doctype html><img src="https://nosuchdomain.exists/logo.jpg" alt="">

I still show the broken image icon in all these situations : https://jsfiddle.net/xtrLo8j1/

Relevant spec is here https://html.spec.whatwg.org/#images-3 and https://html.spec.whatwg.org/#the-img-element. I agree that per spec based on that we should be treating alt="" differently from no alt attribute.

That is a bit odd, is that intentional Anne? WebKit behaves like us, for what is worth.

I'd be a bit wary of changing our behavior here given how bizarre the Blink behavior is:

https://bugs.chromium.org/p/chromium/issues/detail?id=958250
https://bugs.chromium.org/p/chromium/issues/detail?id=753868
https://bugs.chromium.org/p/chromium/issues/detail?id=671871

Though they do get this particular case right, in fairness.

Flags: needinfo?(annevk)

Yeah, that's intentional. alt="" signifies the image has no meaning. Lack of alt signifies that the meaning is unknown. Copying bz as he used to work on this a bunch (and might still?).

Flags: needinfo?(annevk)

I guess WebKit fixed this like two days ago... https://bugs.webkit.org/show_bug.cgi?id=207740

Assignee: nobody → emilio
Status: UNCONFIRMED → NEW
Ever confirmed: true

Yes, alt="" should suppress broken image stuff, generally... I thought we used to do that, but maybe some of the missing-alt changes changed the behavior?

From memory, it had this behavior in a not so old past

Flags: needinfo?(emilio)

mozregression-gui can't narrow the range further because this regression is so old. Bug 1196668 looks like the likely culprit.

https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=d3d642b624886729636c3690a806f38b4d737731&tochange=39dba5141dd90c70a861299459d418d230148d9f

Has Regression Range: --- → yes
Keywords: regression
Regressed by: 1196668
Priority: -- → P3
Flags: needinfo?(emilio)

The spec seems to want us to treat it like an inline, but that's not what other
browsers do (I added tests for this in bug 1196668, and they still pass in all
engines).

This is an oddly specific condition to put in
nsImageFrame::ShouldShowBrokenImageIcon(), but oh well, we're past all sanity
here I think...

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/76472c6d4427
Don't give images with empty alt an intrinsic ratio. r=bzbarsky
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/21924 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.