Skip to content

Commit

Permalink
All images, or role=img, including SVGs need to have an alt tag (carb…
Browse files Browse the repository at this point in the history
…on-design-system#546)

* All images, or role=img, including SVGs need to have an alt tag

Although I disagree with this one because the title element is used by screen readers as the descriptor of svg's according to w3

```In order for elements with a role of img be perceivable, authors MUST provide alternative text or a label determined by the accessible name calculation.```

https://www.w3.org/TR/wai-aria/roles#img

* test: update snapshots
  • Loading branch information
loganmccaul authored and tw15egan committed Jan 31, 2018
1 parent 9028a15 commit 83adc42
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Icon/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const Icon = ({
const svgContent = icon ? svgShapes(icon.svgData) : '';

return (
<svg {...props} aria-label={description}>
<svg {...props} aria-label={description} alt={description}>
<title>{description}</title>
{svgContent}
</svg>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ exports[`ListBoxField should render 1`] = `
role="img"
>
<svg
alt="Clear selected item"
aria-label="Clear selected item"
fillRule="evenodd"
height="10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ exports[`ListBoxSelection should render 1`] = `
role="img"
>
<svg
alt="translation"
aria-label="translation"
fillRule="evenodd"
height="10"
Expand Down Expand Up @@ -85,6 +86,7 @@ exports[`ListBoxSelection should render 2`] = `
role="img"
>
<svg
alt="translation"
aria-label="translation"
fillRule="evenodd"
height="10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ exports[`ModalWrapper should render 1`] = `
role="img"
>
<svg
alt="close the modal"
aria-label="close the modal"
className="bx--modal-close__icon"
fillRule="evenodd"
Expand Down

0 comments on commit 83adc42

Please sign in to comment.