canvas-kit icon indicating copy to clipboard operation
canvas-kit copied to clipboard

Declare icon <svg> as either decorative OR non-decorative icons with text alternatives

Open williamjstanton opened this issue 2 years ago • 0 comments

🚀 Feature Proposal

  • AS A product designer or engineer,
  • I WANT TO declare that the use of icons is either used for decorative purposes only, or needs to have a text alternative,
  • SO THAT I can build a more accessible product for users who cannot see the icons used in the design.

Motivation

Today, icons are presumed always decorative, with an ARIA presentation role on the element. While this holds true most of the time, scenarios are arising where an icon communicates additional meaning that the text alone is not conveying. Engineers need to figure out creative ways to reverse the invalid assumption.

Example

In the "add pill", the '+' icon communicates something visually that is not represented in text. A wrapper needed to be applied to the <svg> where we added a fake ARIA img role, and an aria-label string "add" to communicate a text alternative.

add pill with text alternative

Proposal

Icon graphics need a boolean "isDecorative"

  • true: maintain existing behavior with ARIA presentation role
  • false: remove ARIA presentation role, set aria-label string to the <svg>

Questions:

  • Can we require an aria-label string somehow?
  • Where should the string come from? Authors? Can we include enumerated suggestions...?

AC

Updated storybook example where the role is passed to the icon img

williamjstanton avatar Feb 23 '23 18:02 williamjstanton