Skip to content

Commit cc43808

Browse files
authored
fix(storybook): Add aria-describedby to DateInput examples to date match USWDS example implementation (#3312)
1 parent 57be3d8 commit cc43808

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

dangerfile.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,16 @@ const checkPrDescription: () => void = () => {
109109

110110
const checkCodeChanges: () => void = () => {
111111
// Request changes to package source code to also include changes to tests.
112-
const hasCodeChanges = allFiles.some((p) => !!p.match(/^src\/.*\.[jt]sx?/))
112+
const hasSourceCodeChanges = allFiles.some(
113+
(p) => !!p.match(/^src\/.((?!\.(stories|test)\.).)*\.[jt]sx?/)
114+
)
113115
const hasTestChanges = allFiles.some(
114116
(p) => !!p.match(/^src\/.*\.test\.[jt]sx?/)
115117
)
116-
if (hasCodeChanges && !hasTestChanges) {
118+
const hasStorybookChanges = allFiles.some(
119+
(p) => !!p.match(/^src\/.*\.stories\.[jt]sx?/)
120+
)
121+
if (hasSourceCodeChanges && !hasTestChanges) {
117122
warn(
118123
'This PR does not include changes to tests, even though it affects source code.'
119124
)
@@ -131,11 +136,7 @@ const checkCodeChanges: () => void = () => {
131136
}
132137

133138
// Require new src/components files to include changes to storybook
134-
const hasStorybookChanges = allFiles.some(
135-
(p) => !!p.match(/^src\/.*\.stories\.[jt]sx?/)
136-
)
137-
138-
if (hasCodeChanges && !hasStorybookChanges) {
139+
if (hasSourceCodeChanges && !hasStorybookChanges) {
139140
warn(
140141
'This PR does not include changes to storybook, even though it affects component code.'
141142
)

src/components/forms/DateInput/DateInput.stories.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ export const DateOfBirthExample = (): JSX.Element => (
6363
<DateInputGroup>
6464
<FormGroup className="usa-form-group--month usa-form-group--select">
6565
<Label htmlFor="input-select">Month</Label>
66-
<Select id="testDateInput" name="testDateInput">
66+
<Select
67+
id="testDateInput"
68+
name="testDateInput"
69+
aria-describedby="dateOfBirthHint">
6770
<option>- Select -</option>
6871
<option value="1">01 - January</option>
6972
<option value="2">02 - February</option>
@@ -86,6 +89,7 @@ export const DateOfBirthExample = (): JSX.Element => (
8689
unit="day"
8790
maxLength={2}
8891
minLength={2}
92+
aria-describedby="dateOfBirthHint"
8993
/>
9094
<DateInput
9195
id="testDateInput"
@@ -94,6 +98,7 @@ export const DateOfBirthExample = (): JSX.Element => (
9498
unit="year"
9599
maxLength={4}
96100
minLength={4}
101+
aria-describedby="dateOfBirthHint"
97102
/>
98103
</DateInputGroup>
99104
</Fieldset>

0 commit comments

Comments
 (0)