-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add alt attributes to source elements #6627
Comments
(Slightly related: #4478.) |
cc @whatwg/a11y |
it would make sense to me, yes (assuming it falls back on the |
agreed, this proposal would be very helpful for instances where the different sources don't all match the base text alternative of the And echoing Patrick, would want to make sure it's clear that authors only need to set an |
+1 to all, this would be a good addition and it closes a gap (if people were currently doing art direction that required different alternatives, they could not do that while enjoying the benefits of |
Came here to say the same as @scottaohara and @hidde — this fits the art direction use case. So I also agree. |
This was discussed in ResponsiveImagesCG/picture-element#254 back in 2014, then the conclusion was that the image ought to represent the same information even when doing art direction, and therefore |
@johannesodland do you have a real-world example where you think |
randomly thinking: a another one could be: where there's a large enough viewport, an image that shows a large overview of a location with a crowd, and has an inset (as part of the same image) of a zoomed-in section, to draw attention to that part. the alt would explain that the image shows the whole location, plus the inset. on smaller viewports it might just show the inset picture as a standalone image, and the alt would just refer to that. |
One example I can remember is this article: https://www.nrk.no/ingvild-testet-sirkulaer-okonomi-i-praksis-1.15125257 For the header image of this article the journalists/photographer has chosen to use two different images of the same scene: For desktop there are three persons working, while on mobile there is a closer crop of the protagonist of the story. When using "full-screen" images in articles, it is necessary to use different crops for different screens. This might leave out parts of the original image. I think the replacement text should describe what's visible in the image that is presented to the user. In this case the replacement text on desktop should contain information about the three persons, while on mobile it should only describe the main protagonist. |
In the nearly 7 years since then, and as predicted in the linked conversation, we see that real-world use has varied from the spec. |
The real world users here are not only web authors, but end users of i.e. content management systems. These users are not developers, but journalists, designers, photographers, bloggers etc. I don't think there's any way we can ensure that every crop they decide to use of an image contain the exact same information. With |
@zcorpan said:
Interesting! Makes sense to me… from what I've personally seen, I think in practice images will likely represent the same information in the art direction use case. And if the information really is so different that it warrants a different Having said that, I still feel being able to assign unique alts in the way proposed would be a useful markup option to have for an author. They can art direct today using two regular images with unique And, as @johannesodland says, authoring tools could let authors alts per source. Bit of a tangent, but I know in at least some CMSes alternative text is managed globally in some sort of media library, per file. That is usually not great as alts depend on page context, but may be just what is required in the art direction use case. |
Some of our media libraries indeed have with one alt per crop/file (simplified). As a result we either have to pick one of the alt texts, ask the editor/user to choose one or ask the them to enter a third alt text. Having one alt per source would make it better and more intuitive for the editor user. (The crop shown to the end user will get the alt text that is stored together with that file/crop). |
I work for a media organization, and a large part of our content are news related. The images are often more documentary and are seldom carefully planned and shot. While most sources in the art directed pictures in essence contain the same information, cropping an image in multiple aspect ratios will always exclude some cursory information in one crop while keeping it in the other. With only one alt text, some end user with screen readers will either get a text describing more than what is actually visible on the screen, or less. Having one alt per source will improve the experience of an end user relying on alt text. Having the exact same information in two images with different aspect ratios seems more like a technical purity than something that can be achieved in practice. Having the option of using one alt per source would make it better for both end users (both editors and consumers) and web authors (designers and developers). |
Thanks @johannesodland! I would like to check HTTP Archive for pages that use |
OK I can run httparchive queries again. Out of 6,239,076 pages, there are 35 unique pages using https://docs.google.com/spreadsheets/d/1YKHe_je9If37X-4TE__h3LsQk3_4ICsDXISCRJ8w1Rw/edit?usp=sharing It looks like most of these are using the exact same string in This doesn't show a lot of demand. (Are there any polyfills for this using a different attribute name?) But maybe that's not so surprising. Maybe developers don't bother polyfilling to change the QueriesGetting all extracts of
Getting the instances with
|
Would it be worth looking for any |
@aardrian it's probably better to look at existing polyfills that implement this behavior (if there are any) and then search for pages using them. |
It might be useful to sync this with the need to allow "empty" If one of the |
While i'm sympathetic to the goal here, introducing this information via attributes extends a problem we already have with I think the Internationalization WG will ask you to explore element-based solutions for this kind of thing when adding new features, rather than using attributes for natural language text, ie. something similar to the way that |
That element-based approach was my initial try for a fix in ResponsiveImagesCG/picture-element#254 by re-using the
That seems to check all the “make easy things easy and hard things possible” boxes, but looks a bit clunky. |
When
picture
elements are used for art direction (usingsource
elements with media queries) they use distinct images depending on the environment/screen. These images might have a different layout to adapt to the screen, and would benefit from distinct replacement texts that match the selected image source.Example
A
picture
element has been used for art direction. For vertical screens there is an image with a circle on the top and a box on the bottom. For horizontal screens there is an image with a circle on the left and a box on the right.Proposal
source
elements could support an alt attribute that is set on theimg
element when thesource
is selected. (Similar to how width and height properties now are set on img when a source is selceted: #5894)The text was updated successfully, but these errors were encountered: