-
Notifications
You must be signed in to change notification settings - Fork 165
terra-icon UX Audit #3123
Comments
Additional Consideration: Concerns: One of the largest concerns from a UX perspective is not all icons are going to be approved for standalone use (no text or labels beside them) based on Humans Factors recommendations and Design Standards, only certain icons that have wide/broad understanding can be used by themselves, so having a universal prop that indicates all can be used as standalone might violate Design Standards. We'll need to evaluate further how best to approach it. |
Tech Design 1OverviewAccording to https://a11y-101.com/development/svg , the simplest way to make svgs accessible is to use them in an Currently, terra-icon works as follows: attributes = {
"viewBox":"0 0 48 48",
"xmlns":"http://www.w3.org/2000/svg",
"data-name":"Layer 1"
};
<IconBase {...attributes}>
<path d="M48 21H27V0h-6v21H0v6h21v21h6V27h21z" ></path>
</IconBase> Which returns the following <svg
viewBox="0 0 48 48"
xmlns="http://www.w3.org/2000/svg"
data-name="Layer 1"
>
<path d="M48 21H27V0h-6v21H0v6h21v21h6V27h21z" ></path>
</svg> In order to meet accessibility standards, the resulting Current Props
Proposed Props
This is an active change resulting in a major version bump. Examples uses
const attributes = {
isBidi: false,
iconType: "informative",
alt: "plus icon",
encoding: "none" //default value,
svgSource: "path/to/file.svg"
};
return ( <img src={svgSource} {... other attributes} ></img> );
const attributes = {
isBidi: false,
iconType: "informative",
alt: "plus icon",
encoding: "utf8"
svgSource: `<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><path d="M48 21H27V0h-6v21H0v6h21v21h6V27h21z"/></svg>`,
};
const generatedSVGSource = `data:image/svg+xml;${encoding},${svgSource}`;
return ( <img src={generatedSVGSource} {...other attributes}></img> );
const attributes = {
isBidi: false,
iconType: "informative",
alt: "plus icon",
encoding: "base64"
svgSource: `PHN2ZyBkYXRhLW5hbWU9IkxheWVyIDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDQ4IDQ4Ij48cGF0aCBkPSJNNDggMjFIMjdWMGgtNnYyMUgwdjZoMjF2MjFoNlYyN2gyMXoiLz48L3N2Zz4=`,
};
const generatedSVGSource = `data:image/svg+xml;${encoding},${svgSource}`;
return ( <img src={generatedSVGSource} {...other attributes}></img> ); AccessibilityIn order to meet accessibility standards, the if attributes.role = presentation otherwise attributes.role = undefined To Do
|
As Tech Design 1 is causing complications with the existing icon coloring logic, it is being dropped for Tech Design 2. |
Tech Design 2OverviewAccording to https://www.deque.com/blog/creating-accessible-svgs/ , the simplest and reccommended way to make svgs accessible is to use them in an Currently, terra-icon works as follows: attributes = {
"viewBox":"0 0 48 48",
"xmlns":"http://www.w3.org/2000/svg",
"data-name":"Layer 1"
};
<IconBase {...attributes}>
<path d="M48 21H27V0h-6v21H0v6h21v21h6V27h21z" ></path>
</IconBase> Which returns the following <svg
viewBox="0 0 48 48"
xmlns="http://www.w3.org/2000/svg"
data-name="Layer 1"
>
<path d="M48 21H27V0h-6v21H0v6h21v21h6V27h21z" ></path>
</svg> In order to meet accessibility standards, the resulting <svg
viewBox="0 0 48 48"
xmlns="http://www.w3.org/2000/svg"
data-name="Layer 1"
>
<title>icon title</title>
<path d="M48 21H27V0h-6v21H0v6h21v21h6V27h21z" ></path>
</svg> SolutionThe default component will be updated to be Default Meaningful ComponentThe props for the component will be updated as follows: Current Props
Proposed Props
This is an active change resulting in a major version bump. Resulting htmlthe default <svg
viewBox="0 0 48 48"
xmlns="http://www.w3.org/2000/svg"
data-name="Layer 1"
>
<title>icon title</title>
<path d="M48 21H27V0h-6v21H0v6h21v21h6V27h21z" ></path>
</svg> Decorative iconFor a decorative icon, the Proposed Props
Resulting html<svg
viewBox="0 0 48 48"
xmlns="http://www.w3.org/2000/svg"
data-name="Layer 1"
role="presentation"
>
<path d="M48 21H27V0h-6v21H0v6h21v21h6V27h21z" ></path>
</svg> |
terra-icon
Known Aliases
Document any known aliases of the component, decide if another name makes more sense.
Design Standard Doc
Any documentation needed to be added to terra-ui describing the make up and usage of the component
Any doc examples that need to be updated?
Guides
Any guides needed to be added to terra-ui describing the usage of this component when used with other components.
Accessibility Guides
Behaviours
Accessibility
Deprecation
Related Issues
Other Considerations
Possibly some general clean up of the OCS icon repository.
Need to evaluate icons to make sure they are low lighting correctly.
Look into exporting at 16 rather than 64.
Need to evaluate styling for stand-alone use (without extra styling for text alignment)
The text was updated successfully, but these errors were encountered: