Open
Description
When picture
elements are used for art direction (using source
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.
<picture>
<source src="horizontal.jpg" media="(min-aspect: 1/1)">
<img src="vertical.jpg" alt="A circle and a box">
</picture>
Proposal
source
elements could support an alt attribute that is set on the img
element when the source
is selected. (Similar to how width and height properties now are set on img when a source is selceted: #5894)
<picture>
<source src="horizontal.jpg" media="(min-aspect: 1/1)" alt="A circle to the left of a box">
<img src="vertical.jpg" alt="A circle above a box">
</picture>
Activity