Skip to content

Commit 6fdc5fa

Browse files
authored
docs: Card examples and docs should include headings (microsoft#34943)
1 parent 59f1c01 commit 6fdc5fa

File tree

6 files changed

+27
-11
lines changed

6 files changed

+27
-11
lines changed

packages/react-components/react-card/stories/src/Card/CardAction.stories.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
Link,
1111
makeStyles,
1212
Subtitle1,
13+
Text,
1314
tokens,
1415
} from '@fluentui/react-components';
1516
import { MoreHorizontal20Regular, Open16Regular } from '@fluentui/react-icons';
@@ -111,8 +112,8 @@ export const WithAction = () => {
111112
<CardHeader
112113
image={<img src={resolveAsset('pptx.png')} width="32px" height="32px" alt="Microsoft PowerPoint logo" />}
113114
header={
114-
<Body1>
115-
<b>App Name</b>
115+
<Body1 as="h5" style={{ margin: 0, fontWeight: 'bold' }}>
116+
App Name
116117
</Body1>
117118
}
118119
description={<Caption1>Developer</Caption1>}
@@ -145,9 +146,11 @@ export const WithAction = () => {
145146
<CardHeader
146147
image={<img src={resolveAsset('pptx.png')} width="32px" height="32px" alt="Microsoft PowerPoint logo" />}
147148
header={
148-
<Link href="https://www.microsoft.com/" target="_blank" ref={linkRef} className={styles.link}>
149-
<b>App Name</b>
150-
</Link>
149+
<Text as="h5" style={{ margin: 0 }}>
150+
<Link href="https://www.microsoft.com/" target="_blank" ref={linkRef} className={styles.link}>
151+
<b>App Name</b>
152+
</Link>
153+
</Text>
151154
}
152155
description={<Caption1>Developer</Caption1>}
153156
action={<Button appearance="transparent" icon={<MoreHorizontal20Regular />} aria-label="More options" />}

packages/react-components/react-card/stories/src/Card/CardAppearance.stories.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ const CardExample = ({ className, ...props }: CardProps) => {
7070
<Card {...props} className={mergeClasses(className, styles.card)} onClick={onClick}>
7171
<CardHeader
7272
image={<img className={styles.logo} src={resolveAsset('app_logo.svg')} alt="App name logo" />}
73-
header={<Text weight="semibold">App Name</Text>}
73+
header={
74+
<Text as="h5" style={{ margin: 0 }} weight="semibold">
75+
App Name
76+
</Text>
77+
}
7478
description={<Caption1 className={styles.caption}>Developer</Caption1>}
7579
action={<Button appearance="transparent" icon={<MoreHorizontal20Regular />} aria-label="More options" />}
7680
/>

packages/react-components/react-card/stories/src/Card/CardBestPractices.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
### Accessibility
44

55
- By default, each card is of role="group".
6-
- Provide meaningful `aria-label`, `aria-describedby` and `aria-labelledby` whenever needed, especially for selectable cards.
6+
- If the Card is focusable (any `focusMode` aside from `off`), provide a meaningful `aria-label` or `aria-labelledby` and `aria-describedby` that includes all relevant internal text content.
7+
- For larger Cards that have a single title, use a heading tag to wrap the title text. The specific heading level should be determined by the specific context in which it is used.

packages/react-components/react-card/stories/src/Card/CardFocusMode.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ const CardExample = (props: CardProps) => {
6464
<CardHeader
6565
image={<img src={resolveAsset('pptx.png')} width="32px" height="32px" alt="Microsoft PowerPoint logo" />}
6666
header={
67-
<Body1>
68-
<b>App Name</b>
67+
<Body1 as="h5" style={{ margin: 0, fontWeight: 'bold' }}>
68+
App Name
6969
</Body1>
7070
}
7171
description={<Caption1>Developer</Caption1>}

packages/react-components/react-card/stories/src/Card/CardOrientation.stories.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ export const Orientation = () => {
7070
<Card className={styles.card}>
7171
<CardHeader
7272
image={<img className={styles.headerImage} src={resolveAsset('app_logo.svg')} alt="App Name Document" />}
73-
header={<Text weight="semibold">App Name</Text>}
73+
header={
74+
<Text as="h5" weight="semibold" style={{ margin: 0 }}>
75+
App Name
76+
</Text>
77+
}
7478
description={<Caption1 className={styles.caption}>Developer</Caption1>}
7579
action={<Button appearance="transparent" icon={<MoreHorizontal20Regular />} aria-label="More options" />}
7680
/>

packages/react-components/react-card/stories/src/Card/CardSize.stories.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ const CardExample = (props: CardProps) => {
6969
</header>
7070

7171
<CardHeader
72-
header={<Text weight="semibold">Alert in Teams when a new document is uploaded in channel</Text>}
72+
header={
73+
<Text as="h5" weight="semibold" style={{ margin: 0 }}>
74+
Alert in Teams when a new document is uploaded in channel
75+
</Text>
76+
}
7377
description={<Caption1 className={styles.caption}>By Microsoft</Caption1>}
7478
/>
7579

0 commit comments

Comments
 (0)