[whatwg] alt and title attribute exception
faulkner.steve at gmail.com
Tue Jul 31 05:03:02 PDT 2012
the spec currently says of the alt attribute :
the value of the alt attribute provides equivalent content for those who
> cannot process images or who have image loading disabled (i.e. it is the
> img element's fallback content).
The alt attribute does not represent advisory information. User agents must
> not present the contents of the alt attribute in the same way as content
> of the title attribute.
And this is how it is treated in modern graphical browsers, it is not
displayed unless images are disabled or not available and it is used as the
accessible name for the image in accessibility APIs whether the image is
available or not. Unlike the title attribute which is available in some
browsers when a user hovers their mouse over an image with a title
the spec currently says of the title attribute :
The title attribute represents advisory information for the element, such
> as would be appropriate for a tooltip. On a link, this could be the title
> or a description of the target resource; on an image, it could be the image
> credit or a description of the image.
title has differing semantics to alt. In situations where alt it not
present on an img but title is, in webkit based browsers the title
attribute content is displayed on mouse hover and is also displayed in
place of the image when images are disabled or not available. This
implementation appears to contradict the must requirement in the spec.
User agents must not present the contents of the alt attribute in the same
> way as content of the title attribute.
As there is no way visual distinction between title content being displayed
and of alt content in this case.
>but I'm confused -- is falling back to title a Good Thing that people want
browsers to implement, or is it just a quirk that some legacy browser had?
Given that there is a semantic distinction in the spec between what alt
content is and what title content is and a swathe of normative
requirements/advice based on this distinction it would appear unwise to
promote the use of title as fallback without providing normative
requirements on provision of a method to distinguish between the two.
*Note:* in terms of the accessible name calculation for an img element, if
the image does not have aria-label or an aria-labelledby or an alt
attribute, but does have a title attribute, then the title attribute is
used as the accessible name. From an accessibility API perspective, no
distinction is indicated as to the source of the accessible name (apart
from in the Mac AX API).
The last point is another reason why making the title attribute on images
(without alt) conforming is that the semantics, for all users, are
On 31 July 2012 12:12, Philip Jägenstedt <philipj at opera.com> wrote:
> On Tue, 31 Jul 2012 11:48:52 +0200, Chaals McCathieNevile <w3b at chaals.com>
> On Tue, 31 Jul 2012 11:18:37 +0200, Philip Jägenstedt <philipj at opera.com>
>> AFAICT there's also no way to read the alt attribute on Opera Mobile.
>> You mean title, right?
>> (alt can be read by turning of image loading - although the famous bug
>> http://a11ybugs.org/bug-3.php (I know a few versions of it in Opera's
>> BTS) doesn't help).
> I really did mean the alt attribute, I didn't try turning images off, just
> long-clicking... oops.
> I suppose that if mobile browsers fix Bug 3 *and* fall back to the title
> attribute in the absence of an alt attribute then it would be OK to use
> title instead of alt, but I'm confused -- is falling back to title a Good
> Thing that people want browsers to implement, or is it just a quirk that
> some legacy browser had?
> Philip Jägenstedt
> Core Developer
> Opera Software
More information about the whatwg