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

fix: Update accessibility on avatar in expandable component #1736

Conversation

mannycarrera4
Copy link
Contributor

Summary

Per accessibility, we don't need an alt text on the Expandable Avatar because it is a decorative element. Also, we default the element to be a div because we can't have a button within a button.

category

@cypress
Copy link

cypress bot commented Aug 19, 2022



Test summary

706 0 2 0Flakiness 0


Run details

Project canvas-kit
Status Passed
Commit 7ae13b7 ℹ️
Started Aug 22, 2022 4:45 PM
Ended Aug 22, 2022 4:49 PM
Duration 04:33 💡
OS Linux Ubuntu - 20.04
Browser Electron 94

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

Comment on lines +23 to 25
Component: ({altText, ...elemProps}: ExpandableAvatarProps, ref) => {
return <StyledAvatar altText={undefined} as={'div'} ref={ref} size={32} {...elemProps} />;
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting thing: Avatar component isn't built by our createComponent util function, so this component has some limitation on as prop. For example, with other components we can easily modify element in styled function using as method:

const StyledActionBarText = styled(Box.as('span'))<StyledType>({
  textDecoration: 'underline',
})

Avatar component doesn't have this possibility 🤔 Also, our create component functions have a lot of typescript validation under the hood, and they are not exists in Avatar component because of it.

Should we review this moment and refactor Avatar component (an other components, if they exist) to use util functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch Raisa! Yeah the fact that Avatar is not a createComponent is hindering us here :( We can refactor this now, I don't think it should be a breaking change but it would greatly help us. Let me write up an issue to track this and maybe we can refactor it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's the issue: #1738

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, Avatar is a main component, so we should be careful with making changes in it.
it shouldn't be any change of functionality for users, just inner refactoring so we are probably good to do it.

@mannycarrera4 mannycarrera4 marked this pull request as ready for review August 22, 2022 16:01
@mannycarrera4 mannycarrera4 deleted the mc-expandable-accessibility branch August 22, 2022 17:39
@willklein
Copy link
Contributor

Changes implemented in #1739.

@jaclynjessup jaclynjessup removed the ready for review Code is ready for review label Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants