Skip to content

fix(tile): improve interactive element detection to include aria-role#14239

Merged
tay1orjones merged 5 commits into
carbon-design-system:mainfrom
tay1orjones:13759-detect-role-elements
Jul 26, 2023
Merged

fix(tile): improve interactive element detection to include aria-role#14239
tay1orjones merged 5 commits into
carbon-design-system:mainfrom
tay1orjones:13759-detect-role-elements

Conversation

@tay1orjones

@tay1orjones tay1orjones commented Jul 18, 2023

Copy link
Copy Markdown
Member

Closes #13759

Changelog

New

  • add new getRoleContent() for checking if elements within a tree have an aria-role assigned to them

Changed

  • use getRoleContent() in tile to render the 'expandable with interactive' tile when children elements have an aria-role assigned
  • add tests to cover this case

Testing / Reviewing

  • If an element is rendered within the tile that contains a role but is not interactive, the 'expandable with interactive' tile should be rendered
  • Existing tile stories should operate the same as before.
  • The existing tile stories in the feature flags section should also operate the same as before.

@tay1orjones tay1orjones requested a review from a team as a code owner July 18, 2023 19:28
Comment on lines -666 to -669
if (!getInteractiveContent(belowTheFold.current)) {
setInteractive(false);
return;
} else if (!getInteractiveContent(aboveTheFold.current)) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I also found a bug here where the above-the-fold content was not being checked for interactive elements. This was originally introduced with #13365.

When interactive was inversed to be true by default we no longer needed the optimization to bail out of checking the below-the-fold content for interactive elements if the above-the-fold did have interactive elements (line 668).

The new approach ensures that both the above and below content are checked - if either has interactive elements or a role, the 'expandable with interactive' tile is rendered.

@netlify

netlify Bot commented Jul 18, 2023

Copy link
Copy Markdown

Deploy Preview for carbon-components-react ready!

Name Link
🔨 Latest commit 2e1d231
🔍 Latest deploy log https://app.netlify.com/sites/carbon-components-react/deploys/64bfef095c70a10008ad3f8f
😎 Deploy Preview https://deploy-preview-14239--carbon-components-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify

netlify Bot commented Jul 18, 2023

Copy link
Copy Markdown

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 2e1d231
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/64bfef0956a2ed00089845e6
😎 Deploy Preview https://deploy-preview-14239--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@guidari guidari left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me the changes!! 🚀

Just one thing I noticed is about the a11y violation.

Screenshot 2023-07-20 at 13 26 15

If we add a role to the ExpandableTile the violation is gone.

Screenshot 2023-07-20 at 13 25 03

@tay1orjones

Copy link
Copy Markdown
Member Author

@guidari thanks for catching that! I got so caught up in getting it to detect children with a role that I forgot to address the root issue of the a11y violation 🤦

I added aria-owns to the button controlling the belowTheFold content which solves the violation.

@tay1orjones tay1orjones requested a review from guidari July 24, 2023 19:26
@tay1orjones

Copy link
Copy Markdown
Member Author

@guidari @alisonjoseph This one's ready for review 👍

@guidari guidari left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! 🚀

@alisonjoseph alisonjoseph left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@tay1orjones tay1orjones added this pull request to the merge queue Jul 26, 2023
Merged via the queue into carbon-design-system:main with commit 82beae9 Jul 26, 2023
@tay1orjones tay1orjones deleted the 13759-detect-role-elements branch July 26, 2023 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[a11y]: IBM Accessibility checker reports error on Expandable Tile with Interactive

4 participants