- From: Kornel Lesiński <kornel@geekhood.net>
- Date: Tue, 04 Sep 2012 21:13:00 +0100
- To: public-respimg@w3.org
On Thu, 30 Aug 2012 20:10:54 +0100, Mathew Marquis <mat@matmarquis.com> wrote: > 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` I think there's a third option missing: 3) Don't duplicate the `alt` attribute, reuse fallback in a smart way. Simply don't use `alt` on <picture> at all. Require UAs to read all content of <picture> (including content of <img alt>) when alternative text is required. <picture><img alt="fallback text"></picture> <picture><img alt="fallback"> text</picture> <picture>fallback <img alt="text"></picture> <picture>fallback text</picture> In all examples above the alt would be identical: read as "fallback text". And it would be read basically the same way by <picture>-supporting HTML5 UAs as HTML4 UAs. The algorithm for extracting alt this way is quite simple. In jQuery notation would be: $('picture source').remove() // ignore <source>, keep rest of the content $('picture img').each(function(){ $(this).replace(document.createTextNode(this.alt)) // Replace <img alt="foo"> with "foo" }) var alt = $('picture').text() // take all text remaining in <picture>here</picture> -- regards, Kornel
Received on Tuesday, 4 September 2012 20:13:25 UTC