[whatwg] add html-attribute for "responsive images"

Anselm Hannemann anselm at novolo.de
Tue Feb 7 23:42:23 PST 2012


Am 08.02.2012 um 08:23 schrieb Tab Atkins Jr.:

> 2012/2/7 Anselm Hannemann <anselm at novolo.de>:
>> Am 08.02.2012 um 01:54 schrieb Kornel Lesiński:
>>> On Tue, 07 Feb 2012 14:49:16 -0000, David Goss <dvdgoss at gmail.com> wrote:
>>> 
>>>> I guess I've moved away from similarities with <video>, in that I've
>>>> been thinking of the <img> as the default content, not the fallback
>>>> content. Going with your angle for a simple example with two sizes:
>>>> 
>>>> <picture alt="alternative text" src="default.jpg">
>>>>  <source href="large.jpg" media="min-width:700px" />
>>>>  <img alt="alternative text" src="default.jpg" />
>>>> </picture>
>>> 
>>> A new element may be an opportunity to get the "alt" right, i.e. in element's body, not flattened in an attribute.
>> 
>> Is there a reason for this? I think this is more confusing than everything else. And, an alternative text shouldn't have markup.
>> Alternative text should be all for accessibility. What you thinking about might be the title-attribute. But I'm totally against this approach to do this inside the element w/o attribute.
>> And I think screenreader won't be happy with that, too? (not sure about that).
> 
> No, definitely not.  @alt is useful for accessibility, yes, but it's
> also useful even for sighted people if the image is temporarily
> unavailable.  I have found this ability useful in several concrete
> instances in my webdev career.
> 
> Having the ability to do structured fallback would be even better.
> 
> Screenreaders only have a problem insofar as they don't currently have
> the ability to recognize such markup, because it doesn't exist yet.
> There's nothing theoretically difficult about it, though.

Thanks for clarifying. Then it would be okay to use this style. 

I only have the problem with this "unordered" markup.
In that case we don't have any wrapper for the alt-text and it would just follow as plain on the source-elements.
We always should have wrappers in my mind, we have this for noscript etc, too.
So why not adding <alt>my alternative text here</alt> to the spec?

<picture alt="alternative text" src="default.jpg">
	<img alt="alternative text" src="default.jpg" />
	<source href="large.jpg" media="min-width:700px" />
	<alt>alt text <em>here</em></alt>
</picture>

But in that cases we're now sure we don't want the solution to serve different contents, right?
I mean if we, we should use an attributed version as we then need different alt and title content, too.
And from discussion before that was only two people saying we don't need that.

I'd love to have *ability* (just for future use-cases which might come up and I already would have some for tablet-devices and smartphones) to add different media.
e.g. we could offer a cropped image for smartphone users which has another context (maybe missing important parts of the img due to crop but it's better for smartphone usage and still has it's right to be there as an diff.image).
Would love to hear what you all think about that? 

-Anselm


More information about the whatwg mailing list