Make initials-only rails avatar component default to aria-hidden

What does this MR do and why?

The Rails Avatar component currently uses the item name as a default alt text if no alt text is provided, but this makes no sense when there is no image.

This MR adjusts the default behavior so that by default, initial-only rails avatars will have no alt text and will be aria-hidden.

This MR also adjusts the usage of rails avatar components on Group or Project homepages so that the avatar that immediately precedes the name of the group or project will also have aria-hidden=true, since even if it does have an image, reading the group or project name aloud here will be useless to the screen reader user, who will hear the group or project name read aloud again by the text that follows the avatar.

References

Screenshots or screen recordings

N/A, no change

How to set up and validate locally

  1. check out this branch
  2. Visit a group homepage in the GDK for a group that has no avatar image
  3. inspect the avatar in devtools
  4. you will see that it has no alt text and has aria-hidden="true"
  5. Visit a group homepage in the GDK for a group that DOES have an avatar image
  6. inspect the avatar in devtools
  7. you will see that it has no alt text and has aria-hidden="true"
  8. Visit a project homepage in the GDK for a project that has no avatar image
  9. inspect the avatar in devtools
  10. you will see that it has no alt text and has aria-hidden="true"
  11. Visit a project homepage in the GDK for a project that DOES have an avatar image
  12. inspect the avatar in devtools
  13. you will see that it has no alt text and has aria-hidden="true"

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading