Skip to content

Commit b67008f

Browse files
authored
Merge branch 'main' into focus-on-main-when-content-updates
2 parents 6d91bd4 + 4c6396b commit b67008f

File tree

8 files changed

+2066
-1898
lines changed

8 files changed

+2066
-1898
lines changed

src/app/components/Checkbox.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const CustomCheckbox = styled(
2727
display: flex;
2828
justify-content: center;
2929
align-items: center;
30+
flex-shrink: 0;
3031
3132
input:not(:checked) + & {
3233
border: 1px solid ${theme.color.primary.gray.darker};

src/app/content/components/popUp/ChapterFilter.tsx

+9-6
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ const Row = styled.div`
2424
`;
2525

2626
// tslint:disable-next-line:variable-name
27-
const Column = styled.div`
27+
const Column = styled.ul`
2828
display: flex;
2929
flex-direction: column;
3030
overflow-x: hidden;
31+
list-style: none;
32+
margin: 0;
33+
padding: 0;
3134
`;
3235

3336
// tslint:disable-next-line:variable-name
@@ -119,11 +122,11 @@ const ChapterFilter = (props: ChapterFilterProps) => {
119122
)
120123
: null}
121124
<Row>
122-
{sectionChunks.map((sectionChunk, index) => <Column key={index}>
125+
{sectionChunks.map((sectionChunk, index) => <Column key={index} aria-label='Filter by chapters'>
123126
{sectionChunk.map((location) => {
124127
const { section, children } = location;
125128
if (!children) {
126-
return <ChapterFilterItem
129+
return <li><ChapterFilterItem
127130
key={section.id}
128131
selected={props.selectedLocationFilters.has(section.id)}
129132
disabled={props.disabled || !props.locationFiltersWithContent.has(section.id)}
@@ -132,9 +135,9 @@ const ChapterFilter = (props: ChapterFilterProps) => {
132135
onChange={() => handleChange(section)}
133136
ariaLabel={getAriaLabel(section)}
134137
dataAnalyticsLabel={`Filter PQ by ${splitTitleParts(section.title).join(' ')}`}
135-
/>;
138+
/></li>;
136139
} else {
137-
return <StyledDetails key={section.id} open={openChapterId === section.id}>
140+
return <li><StyledDetails key={section.id} open={openChapterId === section.id}>
138141
<StyledSummary onClick={(ev: React.MouseEvent) => {
139142
ev.preventDefault();
140143
setOpenChapterId((currentId) => currentId !== section.id ? section.id : null);
@@ -156,7 +159,7 @@ const ChapterFilter = (props: ChapterFilterProps) => {
156159
/>
157160
))}
158161
</StyledChapterFilterItemWrapper>
159-
</StyledDetails>;
162+
</StyledDetails></li>;
160163
}
161164
})}
162165
</Column>)}

src/app/content/components/popUp/ColorFilter.tsx

+28-14
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import styled, { css } from 'styled-components/macro';
55
import AllOrNone from '../../../components/AllOrNone';
66
import Checkbox from '../../../components/Checkbox';
77
import { textStyle } from '../../../components/Typography/base';
8-
import theme from '../../../theme';
8+
import theme, { hiddenButAccessible } from '../../../theme';
99
import { highlightStyles } from '../../constants';
1010
import ColorIndicator from '../../highlights/components/ColorIndicator';
1111
import { filters, mobileMarginSides } from '../../styles/PopupConstants';
@@ -19,6 +19,17 @@ const ColorLabel = styled.span`
1919
white-space: nowrap;
2020
`;
2121

22+
// tslint:disable-next-line: variable-name
23+
const Fieldset = styled.fieldset`
24+
padding: 0;
25+
border: none;
26+
margin: 0;
27+
28+
legend {
29+
${hiddenButAccessible}
30+
}
31+
`;
32+
2233
export interface ColorFilterProps {
2334
className?: string;
2435
disabled?: boolean;
@@ -60,19 +71,22 @@ const ColorFilter = ({
6071
onAll={() => setSelectedColors({ remove: [], new: Array.from(colorFiltersWithContent) })}
6172
disabled={disabled}
6273
/>
63-
{styles.map((style) => <Checkbox
64-
key={style.label}
65-
checked={selectedColorFilters.has(style.label)}
66-
disabled={disabled || !colorFiltersWithContent.has(style.label)}
67-
onChange={() => handleChange(style.label)}
68-
>
69-
<ColorIndicator style={style} size='small'/>
70-
<ColorLabel>
71-
<FormattedMessage id={labelKey(style.label)}>
72-
{(msg) => msg}
73-
</FormattedMessage>
74-
</ColorLabel>
75-
</Checkbox>)}
74+
<Fieldset>
75+
<legend>Filter by colors</legend>
76+
{styles.map((style) => <Checkbox
77+
key={style.label}
78+
checked={selectedColorFilters.has(style.label)}
79+
disabled={disabled || !colorFiltersWithContent.has(style.label)}
80+
onChange={() => handleChange(style.label)}
81+
>
82+
<ColorIndicator style={style} size='small'/>
83+
<ColorLabel>
84+
<FormattedMessage id={labelKey(style.label)}>
85+
{(msg) => msg}
86+
</FormattedMessage>
87+
</ColorLabel>
88+
</Checkbox>)}
89+
</Fieldset>
7690
</div>;
7791
};
7892

0 commit comments

Comments
 (0)