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: Use aria-label to describe the meaning of the badges #149

Merged
merged 1 commit into from
Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions src/Components/BidderPortfolio/ClientBadge/ClientBadge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,23 @@ const icons = {

const status$ = ['none', 'warning', 'success'];

const ClientBadge = ({ type, status }) => (
<div className={`usa-grid-full client-badge-container client-badge-container--${icons[type].isIcon ? 'icon' : 'text'} client-badge-container--${status$[status]}`}>
<div className="client-badge">
{
icons[type].isIcon ?
<FA name={icons[type].name} /> :
<span>{icons[type].name}</span>
}
const ClientBadge = ({ type, status }) => {
const ariaLabel = `type of "${type}" with status of "${status$[status]}"`;
return (
<div className={`usa-grid-full client-badge-container client-badge-container--${icons[type].isIcon ? 'icon' : 'text'} client-badge-container--${status$[status]}`}>
<div className="client-badge">
{
icons[type].isIcon ?
<FA aria-label={ariaLabel} name={icons[type].name} /> :
<span aria-label={ariaLabel}>{icons[type].name}</span>
}
</div>
<div className="client-badge-text">
<span>{icons[type].text}</span>
</div>
</div>
<div className="client-badge-text">
<span>{icons[type].text}</span>
</div>
</div>
);
);
};

ClientBadge.propTypes = {
type: PropTypes.oneOf(['handshake', 'sixeight', 'fairshare', 'retirement']).isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ exports[`ClientBadge matches snapshot 1`] = `
className="client-badge"
>
<FontAwesome
aria-label="type of \\"handshake\\" with status of \\"warning\\""
name="handshake-o"
/>
</div>
Expand Down