Re: Alt content [ was: ³Adaptive Image Element Proposal², now off HTML WG list ]

Honestly, neither solution feels "intuitive" from a developer/publisher perspective. Both seem to be cumbersome approaches.

What about saying: if @alt is on <picture>, browsers with picture support will use this value, otherwise if it is absent then they will attempt to fallback to using the @alt value of <img>. So, for example:

<picture>
  <source srcset="file.jpg 1x, file-large.jpg 2x" />
  <img src="file.jpg" alt="Some image here" />
</picture>

The picture element doesn't have an alt attribute, so the browser looks for an img tag and uses that alt attribute. Alternatively, it could also be written like this:

<picture alt="Really nice picture">
  <source srcset="file.jpg 1x, file-large.jpg 2x" />
  <img src="file.jpg" alt="Some image here" />
</picture>

Or

<picture alt="Really nice picture">
  <source srcset="file.jpg 1x, file-large.jpg 2x" />
</picture>

Browsers supporting <picture> will preference <picture>'s @alt value over <img>, and, as in the second example, it leaves the option of completely ignoring the inclusion of <img> altogether.

From: Mathew Marquis <mat@matmarquis.com<mailto:mat@matmarquis.com>>
Date: Thursday, August 30, 2012 12:10 PM
To: "public-respimg@w3.org<mailto:public-respimg@w3.org>" <public-respimg@w3.org<mailto:public-respimg@w3.org>>
Subject: Alt content [ was: “Adaptive Image Element Proposal”, now off HTML WG list ]
Resent-From: <public-respimg@w3.org<mailto:public-respimg@w3.org>>
Resent-Date: Thursday, August 30, 2012 12:11 PM

[ snip ]



[...]
Well, since I suggest that it should be possible to drop the @alt and just let
aria-labelledby point to the picture element, I already operate with a more
complicated rule. So I maintain that this as a proposal to the picture element
editors.

It is a bit more complicated. It also feels more complicated than the replicated @alt, which doesn't mean you can't use ARIA.

I agree. Now, likewise, I see no reason why `aria-labelledby` couldn’t be used here, but I’m not convinced we should make it a requirement. If `aria-labelledby` pointed at `picture` doesn’t work outside of browsers that natively support `picture`, we’ve painted ourselves into a corner—the fallback `img` won’t be able to reference it. Even if this isn’t the case, we’d still be limiting the accessible text to browsing contexts that support `aria-labelledby` — and speaking as an author (and one comfortable and familiar with ARIA attributes), I’m not convinced that this is the more intuitive option. It might be best to open that question up to the RICG before we make any decisions on that basis. I certainly don’t claim to speak for everyone!

Likewise, I’m unsure as to whether an `aria-labelledby` attribute on `picture` pointing at the fallback `img` will be able to access that value in browsers that do support `picture` and don’t receive the fallback. I’ll defer to someone more knowledgeable than I here, but that case does seem a lot more likely.

If that’s a viable approach, would it make sense to specify that the UA should ( given the absence of an `alt` attribute on the `picture` element ) defer to the fallback content for the `alt` by default? Else, if everyone feels that decision is better left to authors, would it be possible to specify that either approach is valid: either specifying an identical `alt` attribute on both `picture` and the fallback `img`, or though the use of `aria-labelledby`?


I’ve pinged a couple of a11y folks I know and asked them if they wouldn’t mind getting involved in these discussions, as I certainly can’t claim to be in a position to make these decisions with complete confidence.

What I’d like to do here is get your thoughts, as authors, on the following:

1) Duplicating the `alt` attribute on both `picture` and the fallback `img`
2) `alt` specified on fallback `img`, using `aria-labelledby` on `picture` to reference the ID of the fallback `img`

If you were marking up a page either by hand or by way through integration with a CMS, which approach feels more intuitive to you? Which would you prefer?

No need for any formality here; I’d just like to discuss this with some proof of author preference on the table. Feel free to reply either to the respimg list or to me directly with your preference, even if it’s just your gut reaction — either in detail, or simply “I think I would be more likely to use [1/2].” I’m lurking in the #respimg IRC channel as well, if you’d like to discuss anything.

Thanks, all. None of this would be happening without you.

-M

Received on Saturday, 1 September 2012 11:43:14 UTC