Skip to content

Commit 4cdd2f5

Browse files
Add visually hidden text to summary list examples (#233)
* Add visually hidden text to summary list examples * Add implimentation notes * Fix className
1 parent 0c2c115 commit 4cdd2f5

File tree

1 file changed

+42
-4
lines changed

1 file changed

+42
-4
lines changed

stories/Content Presentation/SummaryList.stories.tsx

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@ import React from 'react';
33
import { SummaryList, BodyText } from '../../src';
44
import { Meta, StoryObj } from '@storybook/react';
55

6+
7+
/**
8+
* ## Implementation notes
9+
*
10+
* When providing action links, you must include visually hidden text. This means a screen reader user will hear a meaningful action, like "Change name" or "Change date of birth".'
11+
*
12+
* Example of an action link:
13+
*
14+
* ```jsx
15+
* <a href="#">
16+
* Change
17+
* <span className="nhsuk-u-visually-hidden">
18+
* {' '}name
19+
* </span>
20+
* </a>
21+
* ```
22+
*/
23+
24+
625
const meta: Meta<typeof SummaryList> = {
726
title: 'Content Presentation/SummaryList',
827
component: SummaryList,
@@ -15,6 +34,8 @@ SummaryList.Key.displayName = 'SummaryList.Key';
1534
SummaryList.Value.displayName = 'SummaryList.Value';
1635
SummaryList.Actions.displayName = 'SummaryList.Actions';
1736

37+
38+
1839
export const Standard: Story = {
1940
argTypes: {
2041
noBorder: {
@@ -29,14 +50,18 @@ export const Standard: Story = {
2950
<SummaryList.Key>Name</SummaryList.Key>
3051
<SummaryList.Value>Sarah Philips</SummaryList.Value>
3152
<SummaryList.Actions>
32-
<a href="stories#">Change</a>
53+
<a href="#">
54+
Change<span className="nhsuk-u-visually-hidden"> name</span>
55+
</a>
3356
</SummaryList.Actions>
3457
</SummaryList.Row>
3558
<SummaryList.Row>
3659
<SummaryList.Key>Date of birth</SummaryList.Key>
3760
<SummaryList.Value>5 January 1978</SummaryList.Value>
3861
<SummaryList.Actions>
39-
<a href="stories#">Change</a>
62+
<a href="#">
63+
Change<span className="nhsuk-u-visually-hidden"> date of birth</span>
64+
</a>
4065
</SummaryList.Actions>
4166
</SummaryList.Row>
4267
<SummaryList.Row>
@@ -49,7 +74,9 @@ export const Standard: Story = {
4974
SE23 6FH
5075
</SummaryList.Value>
5176
<SummaryList.Actions>
52-
<a href="stories#">Change</a>
77+
<a href="#">
78+
Change<span className="nhsuk-u-visually-hidden"> contact information</span>
79+
</a>
5380
</SummaryList.Actions>
5481
</SummaryList.Row>
5582
<SummaryList.Row>
@@ -59,13 +86,24 @@ export const Standard: Story = {
5986
<BodyText>[email protected]</BodyText>
6087
</SummaryList.Value>
6188
<SummaryList.Actions>
62-
<a href="stories#">Change</a>
89+
<a href="#">
90+
Change<span className="nhsuk-u-visually-hidden"> contact details</span>
91+
</a>
6392
</SummaryList.Actions>
6493
</SummaryList.Row>
6594
</SummaryList>
6695
),
96+
parameters: {
97+
docs: {
98+
description: {
99+
story: 'Change links must include visually hidden text. This means a screen reader user will hear a meaningful action, like "Change name" or "Change date of birth".'
100+
}
101+
}
102+
}
67103
};
68104

105+
106+
69107
export const SummaryListWithoutActions: Story = {
70108
args: { noBorder: false },
71109
render: ({ noBorder }) => (

0 commit comments

Comments
 (0)