Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

[terra-clinical-onset-picker] Fixes screen reader issues #928

Merged
merged 6 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/terra-clinical-onset-picker/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* Added
* Added required prop to mark fields as required based on granularity.

* Fixed
* Fixed screen reader issues related to repetitive announcements.

## 4.36.0 - (September 21, 2023)

* Added
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-clinical-onset-picker/src/OnsetPicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ class OnsetPicker extends React.Component {
{granularitySelect}

{(this.state.precision !== PrecisionOptions.UNKNOWN) && (
<div id="dynamic_content" aria-live="polite">
<div id="dynamic_content">
{ageInput}
{ageUnitSelect}
{monthSelect}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,22 +152,6 @@ it('should render Clinical Onset picker with the correct label for date', () =>
expect(wrapper).toMatchSnapshot();
});

it('should render Clinical Onset picker with the aria-live region', () => {
const wrapper = shallowWithIntl(
<OnsetPicker
ageUnit="years"
birthdate="2011-08-16"
granularity="age"
id="test"
precision="before"
onsetDate="2014-08-16"
/>,
).dive();

expect(wrapper.find('#dynamic_content').prop('aria-live')).toEqual('polite');
expect(wrapper).toMatchSnapshot();
});

it('correctly applies the theme context className', () => {
const tabs = render(
<ThemeContextProvider theme={{ className: 'orion-fusion-theme' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,184 +201,13 @@ exports[`correctly applies the theme context className 1`] = `
</div>
</div>
<div
aria-live="polite"
id="dynamic_content"
/>
</div>
</fieldset>
</div>
`;

exports[`should render Clinical Onset picker with the aria-live region 1`] = `
<div
id="test"
>
<Fieldset
className="fieldset"
isLegendHidden={false}
legendAttrs={Object {}}
required={false}
>
<InjectIntl(SelectField)
className="field-inline precision"
defaultValue="before"
label="Terra.onsetPicker.precision"
labelAttrs={
Object {
"id": "test-precision-select-label",
}
}
onChange={[Function]}
placeholder="Terra.onsetPicker.precision"
selectId="test-precision-select"
>
<Option
disabled={false}
display="Terra.onsetPicker.precisionOnAt"
key="on/at"
value="on/at"
/>
<Option
disabled={false}
display="Terra.onsetPicker.precisionAbout"
key="about"
value="about"
/>
<Option
disabled={false}
display="Terra.onsetPicker.precisionBefore"
key="before"
value="before"
/>
<Option
disabled={false}
display="Terra.onsetPicker.precisionAfter"
key="after"
value="after"
/>
<Option
disabled={false}
display="Terra.onsetPicker.precisionUnknown"
key="unknown"
value="unknown"
/>
</InjectIntl(SelectField)>
<InjectIntl(SelectField)
className="field-inline granularity"
label="Terra.onsetPicker.granularity"
labelAttrs={
Object {
"id": "test-granularity-select-label",
}
}
onChange={[Function]}
placeholder="Terra.onsetPicker.granularity"
selectId="test-granularity-select"
value="age"
>
<Option
disabled={false}
display="Terra.onsetPicker.age"
key="age"
value="age"
/>
<Option
disabled={false}
display="Terra.onsetPicker.year"
key="year"
value="year"
/>
<Option
disabled={false}
display="Terra.onsetPicker.month"
key="month"
value="month"
/>
<Option
disabled={false}
display="Terra.onsetPicker.date"
key="date"
value="date"
/>
</InjectIntl(SelectField)>
<div
aria-live="polite"
id="dynamic_content"
>
<InputField
className="field-inline age"
defaultValue={3}
disabled={false}
error={null}
errorIcon={
<IconError
viewBox="0 0 48 48"
xmlns="http://www.w3.org/2000/svg"
/>
}
help={null}
hideRequired={false}
inputAttrs={
Object {
"max": 6,
"min": 0,
"step": 1,
"type": "number",
}
}
inputId="test-age-input"
isIncomplete={false}
isInline={false}
isInvalid={false}
isLabelHidden={false}
label="Terra.onsetPicker.age"
labelAttrs={
Object {
"id": "test-age-input-label",
}
}
onChange={[Function]}
required={false}
showOptional={false}
/>
<InjectIntl(SelectField)
className="field-inline age-unit"
defaultValue="years"
label="Terra.onsetPicker.agePrecision"
labelAttrs={
Object {
"id": "test-age-unit-select-label",
}
}
onChange={[Function]}
placeholder="Terra.onsetPicker.agePrecision"
required={false}
selectId="test-age-unit-select"
>
<Option
disabled={false}
display="Terra.onsetPicker.agePrecisionWeek"
key="weeks"
value="weeks"
/>
<Option
disabled={false}
display="Terra.onsetPicker.agePrecisionMonth"
key="months"
value="months"
/>
<Option
disabled={false}
display="Terra.onsetPicker.agePrecisionYear"
key="years"
value="years"
/>
</InjectIntl(SelectField)>
</div>
</Fieldset>
</div>
`;

exports[`should render Clinical Onset picker with the correct label for date 1`] = `
<div
id="test"
Expand Down Expand Up @@ -472,7 +301,6 @@ exports[`should render Clinical Onset picker with the correct label for date 1`]
/>
</InjectIntl(SelectField)>
<div
aria-live="polite"
id="dynamic_content"
>
<Field
Expand Down Expand Up @@ -606,7 +434,6 @@ exports[`should render Clinical Onset picker with the correct label for month an
/>
</InjectIntl(SelectField)>
<div
aria-live="polite"
id="dynamic_content"
>
<InjectIntl(SelectField)
Expand Down Expand Up @@ -849,7 +676,6 @@ exports[`should render Clinical Onset picker with the correct label for precisio
/>
</InjectIntl(SelectField)>
<div
aria-live="polite"
id="dynamic_content"
>
<InputField
Expand Down Expand Up @@ -1127,7 +953,6 @@ exports[`should render a default onset picker with specified onset date 1`] = `
</div>
</div>
<div
aria-live="polite"
id="dynamic_content"
/>
</div>
Expand Down Expand Up @@ -1445,7 +1270,6 @@ exports[`should render only the supplied precisions 1`] = `
</div>
</div>
<div
aria-live="polite"
id="dynamic_content"
/>
</div>
Expand Down Expand Up @@ -1654,7 +1478,6 @@ exports[`should render the same when onChange function is supplied 1`] = `
</div>
</div>
<div
aria-live="polite"
id="dynamic_content"
/>
</div>
Expand Down Expand Up @@ -1861,7 +1684,6 @@ exports[`should render with age inputs filled in when supplied 1`] = `
</div>
</div>
<div
aria-live="polite"
id="dynamic_content"
>
<div
Expand Down Expand Up @@ -2209,7 +2031,6 @@ exports[`should render with non default inputs when supplied 1`] = `
</div>
</div>
<div
aria-live="polite"
id="dynamic_content"
>
<div
Expand Down
Loading