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

[terra-menu] - Fixed SR not announcing menu group name information. #1841

Merged
merged 8 commits into from
Oct 31, 2023

Conversation

PK106552
Copy link
Contributor

@PK106552 PK106552 commented Oct 18, 2023

Summary

Screen Reader not fetching group name information because we are wrapping group role items within menu role

What was changed:
If additional group information text is used, provide a string containing the IDs for html elements that help describe the intent of the group of menu. so added aria-describedby attribute in menu items and passing group id to aria-describedby

Why it was changed:
Screen Reader not fetching group name information

Testing

This change was tested using:

  • WDIO
  • Jest
  • Visual testing (please attach a screenshot or recording)
  • Other (please describe below)
  • No tests are needed

Reviews

In addition to engineering reviews, this PR needs:

  • UX review
  • Accessibility review
  • Functional review

Additional Details

This PR resolves:

UXPLATFORM-9744


Thank you for contributing to Terra.
@cerner/terra

Before fix

Screen.Recording.2023-10-18.at.3.22.52.PM.mov

After fix

Screen.Recording.2023-10-18.at.3.31.07.PM.mov

JAWS response for collapsible-menu and terra-menu

Screenshot 2023-10-20 at 11 59 16 AM Screenshot 2023-10-20 at 11 55 57 AM Screenshot 2023-10-20 at 12 10 32 PM

@@ -2,11 +2,14 @@

## Unreleased

* Added
* Added aria-label custom prop and ariaDescribedBy first class prop for `terra-collapsible-menu-view` and `terra-menu` to help describe the intent of the group information.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Added aria-label custom prop and ariaDescribedBy first class prop for `terra-collapsible-menu-view` and `terra-menu` to help describe the intent of the group information.
* Added `aria-label` and `ariaDescribedBy` for `terra-collapsible-menu-view` and `terra-menu` to help describe the intent of the group information.

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 - 4cf4469

Copy link
Contributor

Choose a reason for hiding this comment

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

Update it to

Added aria-label and ariaDescribedBy props

and it looks good!

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 - 3d48277

/**
* String that labels the group for accessibility.
*/
ariaLabel: PropTypes.string,
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 we still need this prop along with this prop we need to create a prop for GroupId so that it can be used in menu item for aria-describedby attribute.

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 - 4cf4469

@@ -2,6 +2,9 @@

## Unreleased

* Added
* Added ariaDescribedBy first class prop to announce group information.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Added ariaDescribedBy first class prop to announce group information.
* Added `ariaDescribedBy` prop for `menu-item` to announce group information.

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 - 4cf4469

/**
* String that used in menu item for aria-describedby that labels the group for accessibility.
*/
GroupId: PropTypes.string,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
GroupId: PropTypes.string,
groupId: PropTypes.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 -f8e50c8

@@ -120,7 +125,7 @@ class CollapsibleMenuViewItemGroup extends React.Component {
]);

return (
<ButtonGroup {...customProps} isMultiSelect={isMultiSelect} onChange={onChange} className={buttonGroupClassNames} selectedKeys={selectedKeys} aria-label={ariaLabel}>
Copy link
Contributor

Choose a reason for hiding this comment

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

why did we removed ariaLabel ..? it is first class prop so we can still use them here correct..??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Still consumer can able to pass aria-label as custom props in collapsible-menu that's why i have removed first class props, if required i can include first class props

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 - f8e50c8

@@ -612,7 +611,6 @@ exports[`Menu correctly applies the theme context className 1`] = `
totalItems={1}
>
<li
aria-describedby="terra-menu-headertitle-00000000-0000-0000-0000-000000000000"
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 you need to update the menu content to use the new prop aria-describedBy of menu-item. to get these ID's back . There as been change made on showHeader prop in menu with this PR : #1649
We might need a to re-test the scenarios of the above PR as well to ensure features added on PR-1649 are still working as expected.

Copy link
Contributor Author

@PK106552 PK106552 Oct 26, 2023

Choose a reason for hiding this comment

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

Updated - a99b426

I have verified with both menuitem as well as group item

Screenshot 2023-10-26 at 10 50 28 AM Screenshot 2023-10-26 at 10 53 25 AM

VC ON :
Screenshot 2023-10-26 at 11 11 12 AM

VC OFF :
Screenshot 2023-10-26 at 11 13 42 AM

@PK106552 PK106552 force-pushed the menu_group_SR_issue branch from 2882a7b to af27824 Compare October 30, 2023 13:44
}
if (!MenuUtils.isMac()) {
if (!this.props.index && this.props.showHeader && index === 0 && value.props.ariaDescribedBy) {
ariaDescribedByValue = `${this.menuTopHeaderId} ${value.props.ariaDescribedBy}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

IDs should be comma separated values

Suggested change
ariaDescribedByValue = `${this.menuTopHeaderId} ${value.props.ariaDescribedBy}`;
ariaDescribedByValue = `${this.menuTopHeaderId}, ${value.props.ariaDescribedBy}`;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

JAWS SR skipping menuHeaderId information If we add comma separated between ID's, SR been reading only second ID information.

@@ -342,6 +343,23 @@ class MenuContent extends React.Component {
);
}

ariaDescribedByHandle(value, index) {
Copy link
Contributor

@supreethmr supreethmr Oct 30, 2023

Choose a reason for hiding this comment

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

This function can be simplified to

    ariaDescribedByHandle(value, index) {
      if (!MenuUtils.isMac() && !this.props.index && this.props.showHeader && index === 0) {
        let ariaDescribedByValue = (value.props.ariaDescribedBy) ? `, ${value.props.ariaDescribedBy}` : '';
        return `${this.menuTopHeaderId}${ariaDescribedByValue}`;
      }
      return value.props.ariaDescribedBy;
    }

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 - 37d673e

@github-actions github-actions bot temporarily deployed to preview-pr-1841 October 31, 2023 04:52 Destroyed
@PK106552 PK106552 requested a review from supreethmr October 31, 2023 06:36
@rahulkumar8cs
Copy link

+1

@supreethmr supreethmr merged commit 4559333 into main Oct 31, 2023
21 checks passed
@supreethmr supreethmr deleted the menu_group_SR_issue branch October 31, 2023 17:41
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.

5 participants