diff --git a/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagAppearance.stories.tsx b/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagAppearance.stories.tsx index 7cbcc742e0acd..eba6b5ea55b1c 100644 --- a/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagAppearance.stories.tsx +++ b/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagAppearance.stories.tsx @@ -16,22 +16,34 @@ export const Appearance = () => { return (
- } hasSecondaryAction> + } hasSecondaryAction id="filled-primary"> filled - + - } hasSecondaryAction> + } hasSecondaryAction id="outline-primary"> outline - + - } hasSecondaryAction> + } hasSecondaryAction id="brand-primary"> brand - +
); diff --git a/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagBestPractices.md b/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagBestPractices.md index 8edc6c05b416a..47c589dd4a18d 100644 --- a/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagBestPractices.md +++ b/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagBestPractices.md @@ -4,7 +4,10 @@ - To group multiple tags together, use `TagGroup`. `TagGroup` can handle dismiss of multiple `InteractionTag`. -- `InteractionTagSecondary` should provide information to screen readers about the secondary action using `aria-label` or `aria-labelledby`. +- `InteractionTagSecondary` should provide information to screen readers about the secondary action using `aria-label` or `aria-labelledby`. To label the`InteractionTagSecondary`component with the added context from`InteractionTagPrimary`, follow these steps: + 1. Apply an `id` attribute to both the InteractionTagPrimary and InteractionTagSecondary components. + 2. Add an `aria-label` attribute to the InteractionTagSecondary component, with a value that describes the secondary action (e.g. "remove"). + 3. Add an `aria-labelledby` attribute to the InteractionTagSecondary component, with the id values of both the InteractionTagPrimary and InteractionTagSecondary components. This will compute the accessible name of the InteractionTagSecondary component. ### Don't diff --git a/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagDisabled.stories.tsx b/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagDisabled.stories.tsx index 09fe7b9eecf7f..8a2dade8dd13a 100644 --- a/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagDisabled.stories.tsx +++ b/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagDisabled.stories.tsx @@ -14,22 +14,49 @@ export const Disabled = () => { return (
- } hasSecondaryAction> + } + hasSecondaryAction + id="disabled-filled-primary" + > disabled - + - } hasSecondaryAction> + } + hasSecondaryAction + id="disabled-outline-primary" + > disabled - + - } hasSecondaryAction> + } + hasSecondaryAction + id="disabled-brand-primary" + > disabled - +
); diff --git a/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagDismiss.stories.tsx b/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagDismiss.stories.tsx index 187597df85838..164b01c98f19c 100644 --- a/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagDismiss.stories.tsx +++ b/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagDismiss.stories.tsx @@ -22,12 +22,22 @@ export const Dismiss = () => { return ( - {visibleTags.map(tag => ( - - {tag.children} - - - ))} + {visibleTags.map(tag => { + const primaryId = `dismiss-primary-${tag.value}`; + const secondaryId = `dismiss-secondary-${tag.value}`; + return ( + + + {tag.children} + + + + ); + })} ); }; diff --git a/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagHasPrimaryAction.stories.tsx b/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagHasPrimaryAction.stories.tsx index 9722b4b018c8e..99e40a7e72c9d 100644 --- a/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagHasPrimaryAction.stories.tsx +++ b/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagHasPrimaryAction.stories.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Popover, PopoverTrigger, PopoverSurface, makeStyles, Tooltip } from '@fluentui/react-components'; +import { Popover, PopoverTrigger, PopoverSurface, makeStyles, Tooltip, Link } from '@fluentui/react-components'; import { InteractionTag, InteractionTagPrimary, InteractionTagSecondary } from '@fluentui/react-tags-preview'; import { bundleIcon, HeartFilled, HeartRegular } from '@fluentui/react-icons'; @@ -21,9 +21,12 @@ export const HasPrimaryAction = () => { - golden retriever + + golden retriever + + Find out more on wiki
  • Size: Medium to large-sized dog breed.
  • Coat: Luxurious double coat with a dense, water-repellent outer layer and a soft, dense undercoat.
  • @@ -32,8 +35,12 @@ export const HasPrimaryAction = () => {
- - + + diff --git a/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagShape.stories.tsx b/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagShape.stories.tsx index 86a52637d7105..ddc25ee33690b 100644 --- a/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagShape.stories.tsx +++ b/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagShape.stories.tsx @@ -29,16 +29,34 @@ export const Shape = () => {
- } secondaryText="Secondary text" hasSecondaryAction> + } + secondaryText="Secondary text" + hasSecondaryAction + id="rounded-primary" + > Rounded - + - } secondaryText="Secondary text" hasSecondaryAction> + } + secondaryText="Secondary text" + hasSecondaryAction + id="circular-primary" + > Circular - + ); diff --git a/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagSize.stories.tsx b/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagSize.stories.tsx index 213b84df4bf80..ffdd06e28adbd 100644 --- a/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagSize.stories.tsx +++ b/packages/react-components/react-tags-preview/stories/InteractionTag/InteractionTagSize.stories.tsx @@ -27,10 +27,18 @@ export const Size = () => { - } hasSecondaryAction> + } + hasSecondaryAction + id="medium-primary" + > Medium dismissible - + @@ -45,10 +53,18 @@ export const Size = () => { - } hasSecondaryAction> + } + hasSecondaryAction + id="small-primary" + > Small dismissible - + @@ -63,10 +79,18 @@ export const Size = () => { - } hasSecondaryAction> + } + hasSecondaryAction + id="extra-small-primary" + > Extra Small dismissible - + diff --git a/packages/react-components/react-tags-preview/stories/Tag/TagBestPractices.md b/packages/react-components/react-tags-preview/stories/Tag/TagBestPractices.md index 3e7e5e3302822..2e0ea09eb2107 100644 --- a/packages/react-components/react-tags-preview/stories/Tag/TagBestPractices.md +++ b/packages/react-components/react-tags-preview/stories/Tag/TagBestPractices.md @@ -4,7 +4,9 @@ - To group multiple tags together, use `TagGroup`. `TagGroup` can handle dismiss of multiple `Tag`. -- Dismissible `Tag` should provide information to screen readers about the dismiss action. For example `dismissIcon={{ 'aria-label': 'remove' }}`. +- Dismissible `Tag` should provide information to screen readers about the dismiss action. There are two ways to label the tag: + - option 1 - add aria-label on dismiss icon, for example `dismissIcon={{ 'aria-label': 'remove' }}`. The accessible name of the Tag will be computed. + - option 2 - add aria-label with the information about dismiss on Tag itself, and the dismiss icon should be hidden from accessibility tree using `dismissIcon={{ role: 'presentation' }}` ### Don't diff --git a/packages/react-components/react-tags-preview/stories/TagGroup/TagGroupDismiss.stories.tsx b/packages/react-components/react-tags-preview/stories/TagGroup/TagGroupDismiss.stories.tsx index 0acaceb3a35fd..9bec051ce4ccb 100644 --- a/packages/react-components/react-tags-preview/stories/TagGroup/TagGroupDismiss.stories.tsx +++ b/packages/react-components/react-tags-preview/stories/TagGroup/TagGroupDismiss.stories.tsx @@ -39,13 +39,23 @@ const DismissWithInteractionTags = () => { }; return ( - - {visibleTags.map(tag => ( - - {tag.children} - - - ))} + + {visibleTags.map(tag => { + const primaryId = `dismiss-primary-${tag.value}`; + const secondaryId = `dismiss-secondary-${tag.value}`; + return ( + + + {tag.children} + + + + ); + })} ); }; diff --git a/packages/react-components/react-tags-preview/stories/TagGroup/TagGroupSizes.stories.tsx b/packages/react-components/react-tags-preview/stories/TagGroup/TagGroupSizes.stories.tsx index 8d8b922d44e4b..93a29cfa3ea25 100644 --- a/packages/react-components/react-tags-preview/stories/TagGroup/TagGroupSizes.stories.tsx +++ b/packages/react-components/react-tags-preview/stories/TagGroup/TagGroupSizes.stories.tsx @@ -33,10 +33,14 @@ export const Sizes = () => { }>{size} - } hasSecondaryAction> + } hasSecondaryAction id={`${size}-primary`}> {size} - +