-
Notifications
You must be signed in to change notification settings - Fork 72
[terra-date-picker] Fix accessibility issues. #1252
Conversation
if (help && error && isInvalid) { | ||
if (error && isInvalid) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the help
condition is needed if we are applying ${datePickerId}-help
to ariaDescriptionIds
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably break this out to two single checks like:
if (help) {
ariaDescriptionIds = `${ariaDescriptionIds} ${datePickerId}-help`;
}
if (error && isInvalid) {
ariaDescriptionIds = `${ariaDescriptionIds} ${datePickerId}-error`;
}
not sure if that is simpler or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should explicitly check for help
if we're adding ${datePickerId}-help
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What my idea was to always provide help
for DatePickerField
because even if the user has not provided any help message but the format message/help message will always be coming from DatePickerField.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. Adding a comment here may help clarify the confusion.
} else if (inputAttributes && inputAttributes['aria-describedby']) { | ||
this.formatDescriptionId = inputAttributes['aria-describedby']; | ||
} else { | ||
this.formatDescriptionId = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the change made in DatePickerField where aria-describedby
will always be provided, it should never get in here. If it ever gets in here, should this be set to undefined
instead of an empty string so that aria-describedby is not defined instead of setting to an empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here fbcd7ea
@@ -219,8 +229,9 @@ class DatePickerInput extends React.Component { | |||
onChange={this.handleOnChange} | |||
onFocus={onFocus} | |||
onBlur={onBlur} | |||
aria-required={required} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this so that voiceover and jaws read required after the label when the field component is required.
# Conflicts: # packages/terra-date-picker/tests/jest/__snapshots__/DateInput.test.jsx.snap # packages/terra-date-picker/tests/jest/__snapshots__/DatePicker.test.jsx.snap
Summary
This PR removes the duplicate id
format
fromDatePickerField
. And cleans up the aria description id's for better accessibility.Part of #1193
Similar to #1244
Deployment Link
https://terra-framework-deployed-pr-#.herokuapp.com/
Testing
Added a new test with multiple Datepickerfield.
Added wdio test for the same
Additional Details
Current behavior:
Updated behavior:

Thank you for contributing to Terra.
@cerner/terra