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

feat(ActionRequirement): improve accessibility #851

13 changes: 8 additions & 5 deletions packages/yoga/src/ActionRequirement/web/ActionRequirement.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,18 @@ function ActionRequirement(props) {
defineCompoundComponents();
return (
<StyledActionRequirement {...props}>
{illustration && <BoxIllustration>{illustration}</BoxIllustration>}

{illustration && (
<BoxIllustration aria-hidden="true">{illustration}</BoxIllustration>
leonardo-gympass marked this conversation as resolved.
Show resolved Hide resolved
)}
<Content>
{titleAsTextDisplay ? (
<Text.Display2>{title}</Text.Display2>
<Text.Display2 as="h1" aria-label={title}>
{title}
</Text.Display2>
) : (
<Title>{title}</Title>
<Title aria-label={title}>{title}</Title>
)}
<Text.Body1 mt="small" color="deep">
<Text.Body1 mt="small" color="deep" aria-label={description}>
leonardo-gympass marked this conversation as resolved.
Show resolved Hide resolved
{description}
</Text.Body1>
{list && <Box mt="large">{list}</Box>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Box from '../../Box';
import Button from '../../Button';

export const Title = styled(Text.H4).attrs({
as: 'p',
as: 'h1',
bold: true,
})`
${({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,14 @@ exports[`<ActionRequirement /> should default match snapshot 1`] = `
<div
class="c1"
>
<p
<h1
aria-label="title"
class="c2"
>
title
</p>
</h1>
<p
aria-label="description"
class="c3"
color="deep"
>
Expand Down Expand Up @@ -271,12 +273,14 @@ exports[`<ActionRequirement /> should match snapshot with list 1`] = `
<div
class="c1"
>
<p
<h1
aria-label="title"
class="c2"
>
title
</p>
</h1>
<p
aria-label="description"
class="c3"
color="deep"
>
Expand Down Expand Up @@ -418,12 +422,14 @@ exports[`<ActionRequirement /> should match snapshot with text display 1`] = `
<div
class="c1"
>
<p
<h1
aria-label="title"
class="c2"
>
title
</p>
</h1>
<p
aria-label="description"
class="c3"
color="deep"
>
Expand Down
Loading