diff --git a/core/assets/vendor/picturefill/picturefill.js b/core/assets/vendor/picturefill/picturefill.js index 4d69569..0dc717e 100644 --- a/core/assets/vendor/picturefill/picturefill.js +++ b/core/assets/vendor/picturefill/picturefill.js @@ -94,6 +94,9 @@ }; // Copy width and height from the source tag to the img element. _copyAttributes(match, newImg); + // Copy alt and title from the source tag to the img element. + newImg.alt = picImg.getAttribute('alt'); + newImg.title = picImg.getAttribute('title'); picImg.parentNode.replaceChild(newImg, picImg); } // We’ve matched, so bail out of the loop here. diff --git a/core/modules/responsive_image/responsive_image.module b/core/modules/responsive_image/responsive_image.module index 5113afc..a09a192 100644 --- a/core/modules/responsive_image/responsive_image.module +++ b/core/modules/responsive_image/responsive_image.module @@ -295,6 +295,16 @@ function theme_responsive_image($variables) { } } $output[] = ' '; + + // Output the controlling image for the picture element. + $controlling_img_attributes = $variables['attributes']; + foreach (array('alt', 'title') as $key) { + if (isset($variables[$key])) { + $controlling_img_attributes["#$key"] = $variables[$key]; + } + } + $output[] = ''; + $output[] = ''; return implode("\n", $output); }