Open
Bug 322413
Opened 19 years ago
Updated 2 years ago
Fix line break handling in ALT attributes (they currently display as black squares)
Categories
(Core :: XUL, defect)
Core
XUL
Tracking
()
NEW
People
(Reporter: steuard+moz, Unassigned)
References
Details
(Keywords: testcase)
Attachments
(1 file)
352 bytes,
text/html
|
Details |
As described in the original report of bug 67127 (which has now thoroughly morphed), newlines appearing in an image's "alt" text are displayed as black squares (the details vary by platform). This can be traced to improper handling of whitespace in attribute values generally, now covered by bug 322270. (I will copy my testcase from that bug to this one shortly; it uses alt text.) As far as I can tell, this is only an issue when the alt text is displayed inside of an image with an explicit size set.
Once that bug is fixed, most instances of this bug will be fixed as well. However, an ideal fix of bug 322270 will be compatible with bug 67127 comment 131, which describes a way for web authors to control line breaks in title elements using explicit character entities. (That will require that newlines in the source code be stripped before entity substitution takes place.)
That same mechanism will presumably apply to "alt" attributes as to "title"s. So after that fix, an entity like " " will still lead to the "black boxes" problem of this bug. But if handled properly, such entities could give page authors some formatting control over alt text (if they really want it). That might be relatively easy to implement using "-moz-pre-wrap" somehow, as mentioned in bug 67127 comment 140 (though that might require a change in the way that alt text is displayed in the first place). In any case, we should make sure that if we do get line breaks in alt attributes, they aren't displayed as junk characters.
Reporter | ||
Comment 1•19 years ago
|
||
This testcase shows how the bug affects "alt" text in images with an explicit size (in this case, large enough to show all of the text). The newlines in the HTML source show up as boxes in the image replacement text. After an ideal fix for bug 322270, we might want these to cause actual line breaks (to give knowledgeable page authors formatting control).
If the image is not given an explicit size, the alt text is eventually displayed as inline HTML or something like it (once the image has finally failed to load). In that case, the newline characters are not displayed (nor are lines broken at all, which is probably the right choice for inline alt text from unsized images).
Comment 2•18 years ago
|
||
Shouldn't this also be dependent on bug 218223? Allowing newlines but not wrapping doesn't make much sense.
Reporter | ||
Comment 3•18 years ago
|
||
As far as I recall, the alt text for an image already does wrap properly (assuming that the image size was specified by the page author, anyway; otherwise, I think the alt text is displayed inline with the surrounding text). If that isn't what you've seen, please do describe the issue!
But you may be thinking of the wrong thing: "alt" text refers to the placeholder text that shows up while an image is loading or if the file is unavailable. The tooltip that gets displayed when you hold your mouse over an image (or whatever) comes from the "title" attribute.
Updated•16 years ago
|
Assignee: jag → nobody
Reporter | ||
Comment 4•11 years ago
|
||
I just looked back at the test case for this in the hope of finding a "worksforme". There are no longer black squares visible in alt text (at least not on my Mac), but there's also no formatting at all: line breaks are still not honored (which may be fine), and white space is not collapsed (which still looks odd). So this is definitely better, but I'd still rather see a more complete fix.
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•