From fb2fd895708ec18093991413bbb4322f28e7783f Mon Sep 17 00:00:00 2001 From: MadanKumarGovindaswamy Date: Fri, 27 Oct 2023 16:09:41 +0530 Subject: [PATCH] Update: Terra-Badge Doc update --- .../terra-dev-site/doc/badge/About.1.doc.mdx | 18 ++++- .../doc/badge/example/BadgeInTable.jsx | 2 +- .../doc/badge/example/BadgeIntent.jsx | 80 ++++++++++++++----- 3 files changed, 79 insertions(+), 21 deletions(-) diff --git a/packages/terra-core-docs/src/terra-dev-site/doc/badge/About.1.doc.mdx b/packages/terra-core-docs/src/terra-dev-site/doc/badge/About.1.doc.mdx index a9b45c3b4fb..21ab8bd7cac 100644 --- a/packages/terra-core-docs/src/terra-dev-site/doc/badge/About.1.doc.mdx +++ b/packages/terra-core-docs/src/terra-dev-site/doc/badge/About.1.doc.mdx @@ -12,7 +12,7 @@ import BadgePropsTable from 'terra-badge/lib/Badge?dev-site-props-table'; # Terra Badge -The badge component displays content classification. +Badges are used to represent items like number of filtered items, number of unread items, or to represent state. If you need a selectable annotation consider using a label instead. ## Getting Started @@ -43,6 +43,22 @@ The Badge component must be composed inside the [Base][1] component with a local import Badge from 'terra-badge'; ``` +To implement an accessible terra badge: + +- Ensure a meaningful text is provided as `text` prop for terra-badge and choose appropriate intent that matches the defination of Badge text. + +- Ensure Information is not conveyed by only color added by different intent of terra-badge. + +- Ensure that the terra-badge is provided with visually hidden text to convey the purpose of the badge to users via screen reader or similar assistive technologies when required. + +- When multiple badges are used together, Consider following steps which will help users to perceive or understand the difference between the two badges. + + - Add an icon to visually convey information. + - Add a visually-hidden-text to convey information for screen reader users. + - Avoid having badges with similar intent on group. + +- visually-hidden-text should be ignored when the badge color and text is sufficient to convey information of badge. + ## Component Features * [Cross-Browser Support](https://engineering.cerner.com/terra-ui/about/terra-ui/component-standards#cross-browser-support) * [Responsive Support](https://engineering.cerner.com/terra-ui/about/terra-ui/component-standards#responsive-support) diff --git a/packages/terra-core-docs/src/terra-dev-site/doc/badge/example/BadgeInTable.jsx b/packages/terra-core-docs/src/terra-dev-site/doc/badge/example/BadgeInTable.jsx index 19f69b6d8b9..267bd175d07 100644 --- a/packages/terra-core-docs/src/terra-dev-site/doc/badge/example/BadgeInTable.jsx +++ b/packages/terra-core-docs/src/terra-dev-site/doc/badge/example/BadgeInTable.jsx @@ -45,7 +45,7 @@ const BadgeInTable = () => (
- +
diff --git a/packages/terra-core-docs/src/terra-dev-site/doc/badge/example/BadgeIntent.jsx b/packages/terra-core-docs/src/terra-dev-site/doc/badge/example/BadgeIntent.jsx index 4537a7a5290..dffaeb5b12e 100644 --- a/packages/terra-core-docs/src/terra-dev-site/doc/badge/example/BadgeIntent.jsx +++ b/packages/terra-core-docs/src/terra-dev-site/doc/badge/example/BadgeIntent.jsx @@ -6,29 +6,71 @@ import styles from './Badge.module.scss'; const cx = classNames.bind(styles); const BadgeIntent = () => ( -
-
- + +

+ Intent with severity of issues. +

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
-
- +

+ Secondary Intent can be used to label user name as NEW +

+
+
+ Segun Adebayo + +
-
- +

+ Primary Intent with unread items +

+
+
+ +
+
+ +
+
+ +
+
+ +
-
- +

+ Default Intent with read items +

+
+
+ +
+
+ +
+
+ +
+
+ +
-
- -
-
- -
-
- -
-
+ ); export default BadgeIntent;