Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Commit 6c18b2b

Browse files
committed
Accessibility EQC side menu.
1 parent 6f9811f commit 6c18b2b

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

src/components/blocks/CheckItem.tsx

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,23 @@ export const CheckItem = ({
3030
<LinkBlock
3131
block={block}
3232
/>
33-
<LinkStatus status={block.status}></LinkStatus>
33+
<LinkStatus status={block.status}/>
3434
</LinkTextWrapper>
35-
<div
35+
<LinkButton
36+
aria-label={
37+
isExpanded ? 'Collapse' : 'Expand'
38+
}
3639
onClick={() => setIsExpanded(!isExpanded)}>{
37-
isExpandable ? <ExpandIcon state={isExpanded} /> : null}</div>
40+
isExpandable ? <ExpandIcon state={isExpanded} /> : null}</LinkButton>
3841
</LinkWrapper>
3942
{isExpandable && (
4043
<Content data-stylizable="block checkitem-content"
4144
className={
4245
isExpanded ? 'expanded' : ''
4346
}>
44-
<GenerateBlocks blocks={supportedBlocks} />
47+
{isExpanded && (
48+
<GenerateBlocks blocks={supportedBlocks} />
49+
)}
4550
</Content>
4651
)}
4752
</Wrapper>
@@ -58,7 +63,11 @@ const ExpandIcon = ({
5863
transform: state ? 'rotate(180deg)' : 'rotate(0deg)',
5964
}}
6065
>
61-
<DownIcon />
66+
<DownIcon
67+
title={
68+
state ? 'Collapse' : 'Expand'
69+
}
70+
/>
6271
</ExpandIconWrapper>
6372
)
6473
}
@@ -98,6 +107,14 @@ const ExpandIconWrapper = styled.div`
98107
cursor: pointer;
99108
`
100109

110+
const LinkButton = styled.button`
111+
background: none;
112+
border: none;
113+
cursor: pointer;
114+
padding: 0;
115+
margin: 0;
116+
`
117+
101118
const Wrapper = styled.section`
102119
margin-top: 0;
103120
width: 100%;

src/components/icons/EQCIcons.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,41 @@
11
import React from 'react';
22

33
export const CheckIcon = ({
4-
color = '#4CAF50'
4+
color = '#4CAF50',
5+
title = 'QA Passed'
56
}: {
67
color?: string
8+
title?: string
79
}) =>
810
(<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
11+
<title>{title}</title>
912
<path d="M5 12L10 17L20 7" stroke={color} />
1013
</svg>
1114
);
1215

1316
export const WarningIcon = ({
14-
color = '#FF9800'
17+
color = '#FF9800',
18+
title = 'QA Not Passed'
1519
}: {
1620
color?: string
21+
title?: string
1722
}) => (
1823
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
24+
<title>{title}</title>
1925
<path d="M12 8V14 m0 2v1" stroke={color} />
2026
<path d="M5 19H19C19.3263 18.9977 19.6471 18.9156 19.9344 18.7609C20.2217 18.6061 20.4667 18.3834 20.6482 18.1122C20.8297 17.841 20.942 17.5295 20.9754 17.2049C21.0089 16.8803 20.9624 16.5525 20.84 16.25L13.74 3.99999C13.567 3.68738 13.3135 3.42682 13.0058 3.24537C12.698 3.06393 12.3473 2.96823 11.99 2.96823C11.6327 2.96823 11.282 3.06393 10.9742 3.24537C10.6665 3.42682 10.413 3.68738 10.24 3.99999L3.14 16.25C3.01994 16.5456 2.97233 16.8656 3.00115 17.1833C3.02997 17.501 3.13437 17.8072 3.30565 18.0764C3.47693 18.3455 3.71011 18.5698 3.98573 18.7305C4.26134 18.8912 4.57139 18.9836 4.89 19" stroke={color} />
2127
</svg>
2228
)
2329

2430
export const DownIcon = ({
25-
color = '#25408F'
31+
color = '#25408F',
32+
title = 'Open icon'
2633
}: {
2734
color?: string
35+
title?: string
2836
}) => (
2937
<svg width="12" height="7" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg">
38+
<title>{title}</title>
3039
<path d="M1 1L6 6L11.5 1" stroke={color} />
3140
</svg>
3241
)

0 commit comments

Comments
 (0)