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

[terra-date-picker] Fix accessibility issues. #1252

Merged
merged 21 commits into from
Oct 7, 2020

Conversation

pranav300
Copy link
Contributor

@pranav300 pranav300 commented Sep 21, 2020

Summary

This PR removes the duplicate id format from DatePickerField. 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:

old

Updated behavior:
new

Thank you for contributing to Terra.
@cerner/terra

@mjhenkes mjhenkes temporarily deployed to terra-framew-date-picke-fpeyd5 September 21, 2020 09:40 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-framew-date-picke-fpeyd5 September 21, 2020 09:47 Inactive
if (help && error && isInvalid) {
if (error && isInvalid) {
Copy link
Contributor

@emilyrohrbough emilyrohrbough Sep 21, 2020

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.

Copy link
Contributor

@emilyrohrbough emilyrohrbough Sep 21, 2020

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

Copy link
Contributor

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.

Copy link
Contributor Author

@pranav300 pranav300 Sep 22, 2020

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.

Copy link
Contributor

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.

@mjhenkes mjhenkes temporarily deployed to terra-framew-date-picke-fpeyd5 September 22, 2020 11:47 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-framew-date-picke-fpeyd5 September 22, 2020 13:35 Inactive
} else if (inputAttributes && inputAttributes['aria-describedby']) {
this.formatDescriptionId = inputAttributes['aria-describedby'];
} else {
this.formatDescriptionId = '';
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here fbcd7ea

@mjhenkes mjhenkes temporarily deployed to terra-framew-date-picke-fpeyd5 September 24, 2020 17:22 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-framew-date-picke-fpeyd5 September 25, 2020 04:59 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-framew-date-picke-fpeyd5 September 28, 2020 15:50 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-framew-date-picke-fpeyd5 September 29, 2020 19:05 Inactive
@@ -219,8 +229,9 @@ class DatePickerInput extends React.Component {
onChange={this.handleOnChange}
onFocus={onFocus}
onBlur={onBlur}
aria-required={required}
Copy link
Contributor Author

@pranav300 pranav300 Sep 29, 2020

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.

@mjhenkes mjhenkes temporarily deployed to terra-framew-date-picke-fpeyd5 September 30, 2020 05:51 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-framew-date-picke-fpeyd5 September 30, 2020 05:51 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-framew-date-picke-fpeyd5 September 30, 2020 17:55 Inactive
# Conflicts:
#	packages/terra-date-picker/tests/jest/__snapshots__/DateInput.test.jsx.snap
#	packages/terra-date-picker/tests/jest/__snapshots__/DatePicker.test.jsx.snap
@mjhenkes mjhenkes temporarily deployed to terra-framew-date-picke-fpeyd5 October 7, 2020 18:30 Inactive
@mjhenkes mjhenkes merged commit 5c0428d into main Oct 7, 2020
@mjhenkes mjhenkes deleted the date-picker-remove-placeholder-cleanup branch October 7, 2020 19:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants