Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a11y- Callouts should use descriptive text for icons #7882

Merged
merged 10 commits into from
Sep 6, 2024

Conversation

katiegoines
Copy link
Contributor

@katiegoines katiegoines commented Aug 9, 2024

Description of changes:

[Issue] There are meaningful "Info" icons but they are marked as decorative.
[Fix] Since the icon is part of Amplify UI component we cannot remove the aria-hidden without updating that component. We could move those icons inline to the content (and use hasIcon={false} on the component)

Staging: https://a11y-callout-icons.d1egzztxsxq9xz.amplifyapp.com/gen1/react/start/getting-started/

Example of page with protected callout: https://a11y-callout-icons.d1egzztxsxq9xz.amplifyapp.com/react/build-a-backend/data/data-modeling/relationships/

Related GitHub issue #, if available:

Instructions

If this PR should not be merged upon approval for any reason, please submit as a DRAFT

Which product(s) are affected by this PR (if applicable)?

  • amplify-cli
  • amplify-ui
  • amplify-studio
  • amplify-hosting
  • amplify-libraries

Which platform(s) are affected by this PR (if applicable)?

  • JS
  • Swift
  • Android
  • Flutter
  • React Native

Please add the product(s)/platform(s) affected to the PR title

Checks

  • Does this PR conform to the styleguide?

  • Does this PR include filetypes other than markdown or images? Please add or update unit tests accordingly.

  • Are any files being deleted with this PR? If so, have the needed redirects been created?

  • Are all links in MDX files using the MDX link syntax rather than HTML link syntax?

    ref: MDX: [link](https://docs.amplify.aws/)
    HTML: <a href="https://docs.amplify.aws/">link</a>

When this PR is ready to merge, please check the box below

  • Ready to merge

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@katiegoines katiegoines changed the title add alt-text for info icon a11y- Callouts should use descriptive text for icons Aug 9, 2024
@katiegoines katiegoines marked this pull request as ready for review August 9, 2024 17:12
jacoblogan
jacoblogan previously approved these changes Aug 9, 2024
Copy link
Contributor

@hbuchel hbuchel left a comment

Choose a reason for hiding this comment

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

Couple comments about the IMG wrapper and warning variation.

>
<View>{children}</View>
<Flex>
<div role="img" aria-label="info" className="amplify-message__icon">
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of wrapping this in an IMG role, I think you should be able to pass aria-hidden="false" to the Icon and pass it an appropriate aria-label.

<View>{children}</View>
<Flex>
<div role="img" aria-label="info" className="amplify-message__icon">
<IconInfo aria-hidden={true} />
Copy link
Contributor

@hbuchel hbuchel Aug 9, 2024

Choose a reason for hiding this comment

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

I think we should account for the warning variation as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added in labeling to account for the variation however currently only the Info icon is being used regardless of the message type

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Although I just checked and we don't have an IconWarning so it would have to be added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the IconWarning and adjusted the logic to account for the variation

Copy link
Contributor

@hbuchel hbuchel left a comment

Choose a reason for hiding this comment

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

Left a note about aria-label content and an issue with missing class name.

src/components/Callout/Callout.tsx Outdated Show resolved Hide resolved
src/components/Callout/Callout.tsx Outdated Show resolved Hide resolved
src/components/Callout/Callout.tsx Outdated Show resolved Hide resolved
@katiegoines katiegoines enabled auto-merge (squash) August 14, 2024 21:04
Copy link
Contributor

@jordanvn jordanvn left a comment

Choose a reason for hiding this comment

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

These changes look good to me. It appears that @hbuchel's feedback has all been addressed and I've confirmed expected functionality locally. This is a nice change for accessibility!

@katiegoines katiegoines merged commit 2053da0 into main Sep 6, 2024
12 checks passed
@katiegoines katiegoines deleted the a11y-callout-icons branch September 6, 2024 18:46
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.

5 participants