[whatwg] add html-attribute for "responsive images"
David Goss
dvdgoss at gmail.com
Wed Feb 8 01:18:25 PST 2012
On 8 February 2012 07:42, Anselm Hannemann <anselm at novolo.de> wrote:
> 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>
If the alt text was going to be inside <picture> and contain markup,
then yes, I'd say it should have its own element as well, otherwise
the markup and DOM both become messy...but personally I'm not
convinced. The existing alt attribute does the job (when it's actually
*used*), so the only difference with this <alt> idea is being able to
have text-level markup in it. How much would this improve
accessibility? The current accessibility problem with the alt
attribute is that authors often omit it, and an <alt> element won't
change that.
Plus, it would only apply to <picture> (or whatever we call it) -
<img> would have to be left the way it is because it has no closing
tag and therefore can't wrap the <alt> tag.
> 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.
And only one person saying we do, but that's not the point.
> 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?
We're thinking along the same lines here. What I was getting as
yesterday was that the different <source>s shouldn't necessarily have
to be *literally* the same image but resized. They could be
derivatives of the image (your example of cropped is good). The rule I
suggest is that you must be able to successfully describe all the
images with the same alt text (which goes on <picture>), so although
the images are not visually identical they are semantically the same.
The question is whether the <source>s can have optional alt attributes
themselves so authors can more specifically describe that particular
variant of the image. My hesitation only comes from wanting to keep it
clean and simple, and from wanting to reinforce the requirement that
the images be semantically the same.
More information about the whatwg
mailing list