fabric-ds / issues

Site for tracking tasks and issues related to Fabric
0 stars 0 forks source link

Add support for title and label prop to icons packages #75

Open digitalsadhu opened 2 years ago

digitalsadhu commented 2 years ago

We need to either create a title element as the first child element to the SVG or add aria-label="" and role="img" attributes to the SVG element itself for our icons components.

The user can choose to supply a title prop or a label prop and the difference is that title will create the title element which will add a tool tip while the label approach will not. The user cannot supply both a title AND a label prop. If the user supplies the title, we should use this value to also set the label and role. If no title or label is supplied, set aria-hidden="true" (however, everyone should be strongly encouraged to set either a title or label)

This should be done for both the React the Vue icons libraries.

Good guidelines should also be written. Users should always provide either a title or a label and we should be clear about which language. (At Finn this is always Norwegian). Users should be informed about what sort of text to use as the label/title. Eg. "Close" not "Close icon" and in fact if the close button looks like an x then the label should just be an x. If the icon looks like a house, then just "house" etc.

pearofducks commented 2 years ago

I would guess a lot of our icons are going to be brought in via raw SVG rather than the JS components. Do we have a best-practice or set of changes we should make there?

By this I mean something like

import Landscape from '@fabric-ds/icons/dist/48/landscape.svg'
digitalsadhu commented 2 years ago

After discussion we are leaning toward the following approach:

digitalsadhu commented 2 years ago

We can also look into whether its possible to add description meta data to the Figma file for use during import

pearofducks commented 2 years ago

Based on the goofiness I've seen from Figma, I'd kinda like to avoid this unless they're saying it's supported as a first-class citizen or something (or if there's some huge QOL improvement vs managing this data elsewhere, but I doubt that would be the case!)