diff --git a/src/components/Icon.js b/src/components/Icon.js index a6043fa4..62a34cf5 100644 --- a/src/components/Icon.js +++ b/src/components/Icon.js @@ -15,6 +15,12 @@ const Path = styled.path` fill: currentColor; `; +/** + * An Icon is a piece of visual element, but we must ensure its accessibility while using it. + * It can have 2 purposes: + * - decorative only: for example, it illustrate a label next to it. We must ensure that it is ignored by screen readers, by setting `aria-hidden` attribute (ex: ) + * - non-decorative: it means that it delivers an information. For example, an icon as only child inn a button. The meaning can be obvious visually, but it must have a proper text alternative via `aria-label` for screen readers. (ex: ) + */ export function Icon({ icon, block, ...props }) { return ( diff --git a/src/components/Icon.stories.js b/src/components/Icon.stories.js index e5e5fe37..a5cc25f9 100644 --- a/src/components/Icon.stories.js +++ b/src/components/Icon.stories.js @@ -6,11 +6,11 @@ import { Icon } from './Icon'; import { icons } from './shared/icons'; const Meta = styled.div` - color: #999; + color: #666; font-size: 12px; `; -const Item = styled.div` +const Item = styled.li` display: inline-flex; flex-direction: row; align-items: center; @@ -43,9 +43,10 @@ const Item = styled.div` `}; `; -const List = styled.div` +const List = styled.ul` display: flex; flex-flow: row wrap; + list-style: none; `; storiesOf('Design System|Icon', module) @@ -56,7 +57,7 @@ storiesOf('Design System|Icon', module) {Object.keys(icons).map(key => ( - + {key} ))} @@ -67,18 +68,18 @@ storiesOf('Design System|Icon', module) {Object.keys(icons).map(key => ( - + ))} )) .add('inline', () => ( - this is an inline icon (default) + this is an inline icon (default) )) .add('block', () => ( - this is a block icon + this is a block icon ));