You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Standalone needs to be accessible and this is the standard pattern for that:
<!-- role="img" so that the SVG is not traversed by browsers that map the SVG to the "group" role --><!-- aria-labelledby pointing to ID's of title and desc because some browsers incorrectly don't use them unless we do --><!-- if you are using a <use>-based icon system, this would be a <symbol id="unique-id"> below, but otherwise the same --><svgrole="img" viewBox="0 0 100 100" aria-labelledby="unique-title-id unique-desc-id"><!-- title becomes the tooltip as well as what is read to assistive technology --><!-- must be the first child! --><titleid="unique-title-id">Short Title (e.g. Add to Cart)</title><!-- longer description if needed --><descid="unique-desc-id">A friendly looking cartoon cart icon with blinking eyes.</desc><!-- all the SVG drawing stuff --><pathd="..." /></svg>
Decorative just needs aria-hidden="true
<button><svgaria-hidden="true" viewBox="0 0 100 100"><!-- or <use>, if using a <symbol>-based icon system --><pathd="..." /></svg>
Add to Cart
</button>
It would be great if we could somehow bake this into the icon system, instead of pushing that off to the user. You could imagine something like this working:
<Icon icon="icon-cart.svg" standalone="true" />
I'm not sure how we would go about this.
The text was updated successfully, but these errors were encountered:
In an effort to make Gridicons an effective icon system, I think it would great to include a way to make the icon accessible as an option.
Take a look at this article:
https://css-tricks.com/can-make-icon-system-accessible/
Icons can be either standalone or decorative.
Standalone needs to be accessible and this is the standard pattern for that:
Decorative just needs
aria-hidden="true
It would be great if we could somehow bake this into the icon system, instead of pushing that off to the user. You could imagine something like this working:
<Icon icon="icon-cart.svg" standalone="true" />
I'm not sure how we would go about this.
The text was updated successfully, but these errors were encountered: