Skip to content

il image feature accessibility issues

Jon Gunderson edited this page Nov 9, 2021 · 1 revision

Accessibility Issues

Web Component: <il-image-feature>

Dev Codepen: https://codepen.io/il-toolkit/pen/PomJdrE

Source Code

<il-image-feature 
  alt="text alternative" 
  src="https://cdn.brand.illinois.edu/toolkit/dev/examples/_assets/images/hero-bg.jpg">
.... 
</il-image-feature>

Rendered Shadow DOM Code

<div class="imagefeature">
  <div class="background" 
    role="presentation" 
    style="background-image: url('https://cdn.brand.illinois.edu/toolkit/dev/examples/_assets/images/hero-bg.jpg'); 
    flex: 1;">
    <!--?lit$814659999$-->
    text alternative
  </div>

Accessibility Considerations

  • Background images are not rendered in high contrast modes on Windows 10.
  • The use of role="presentation" is not needed on a div element if the image is considered decorative.
  • If the image is informative (e.g. presence of non-empty alt attribute) the role should be img and the alt attribute should generate an aria-label, rather than text content.

Clone this wiki locally