Redundant img role (Test 46)
Test 46 flags img elements that carry a redundant role="img" attribute, since img already has a
native semantic role of img. Images whose src ends in .svg (optionally followed by a query string
or URL fragment, e.g. cache-busting "logo.svg?v=2") are excluded from this test, since some
assistive technologies have historically misread the src of svg images without an explicit role="img"
(WebKit bug 216364), and adding
role="img" to svg-sourced img elements is a recognized best practice. See:
MDN: identifying SVG as an image.
img with no role - N/A
img with role="img" not visible in the DOM - N/A
img with role="img" not available to assistive technology - N/A
img with role="img" and a raster (.jpg) src - Fail
img with role="img" and no src - Fail
img with role="img" and a src ending in .svg - Pass
img with role="img" and a src ending in .SVG (all caps) - Pass
img with role="img" and a src ending in .SvG (mixed case) - Pass
img with role="img" and a .svg src followed by a cache-busting query string - Pass
img with role="img" and a .svg src followed by a URL fragment - Pass
img with role="img" and a src that merely contains .svg mid-string (not the real extension) - Fail
Real world example (SidearmSports / UserWay widget) - Pass