Skip to content

Commit 160e605

Browse files
committed
Make custom DNS section accessible
1 parent 87dd20b commit 160e605

File tree

2 files changed

+69
-21
lines changed

2 files changed

+69
-21
lines changed

gui/src/renderer/components/AdvancedSettings.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -440,14 +440,20 @@ export default class AdvancedSettings extends React.Component<IProps, IState> {
440440
</StyledButtonCellGroup>
441441

442442
<StyledCustomDnsSwitchContainer>
443-
<Cell.InputLabel>
444-
{messages.pgettext('advanced-settings-view', 'Use custom DNS server')}
445-
</Cell.InputLabel>
446-
<Cell.Switch
447-
ref={this.customDnsSwitchRef}
448-
isOn={this.props.dns.custom}
449-
onChange={this.setCustomDnsEnabled}
450-
/>
443+
<AriaInputGroup>
444+
<AriaLabel>
445+
<Cell.InputLabel>
446+
{messages.pgettext('advanced-settings-view', 'Use custom DNS server')}
447+
</Cell.InputLabel>
448+
</AriaLabel>
449+
<AriaInput>
450+
<Cell.Switch
451+
ref={this.customDnsSwitchRef}
452+
isOn={this.props.dns.custom}
453+
onChange={this.setCustomDnsEnabled}
454+
/>
455+
</AriaInput>
456+
</AriaInputGroup>
451457
</StyledCustomDnsSwitchContainer>
452458
<Accordion expanded={this.props.dns.custom}>
453459
<CellList items={this.customDnsItems()} onRemove={this.removeDnsAddress} />

gui/src/renderer/components/cell/List.tsx

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React, { useCallback } from 'react';
22
import styled from 'styled-components';
33
import { colors } from '../../../config.json';
4+
import { messages } from '../../../shared/gettext';
5+
import { AriaDescribed, AriaDescription, AriaDescriptionGroup } from '../AriaGroup';
46
import ImageView from '../ImageView';
57
import * as Cell from '.';
68

@@ -40,6 +42,22 @@ export default function CellList<T>(props: ICellListProps<T>) {
4042
);
4143
}
4244

45+
const StyledContainer = styled(Cell.Container)({
46+
display: 'flex',
47+
marginBottom: '1px',
48+
backgroundColor: colors.blue40,
49+
});
50+
51+
const StyledButton = styled.button({
52+
display: 'flex',
53+
alignItems: 'center',
54+
flex: 1,
55+
border: 'none',
56+
background: 'transparent',
57+
padding: 0,
58+
margin: 0,
59+
});
60+
4361
const StyledLabel = styled(Cell.Label)({}, (props: { paddingLeft: number }) => ({
4462
fontFamily: 'Open Sans',
4563
fontWeight: 'normal',
@@ -51,6 +69,18 @@ const StyledLabel = styled(Cell.Label)({}, (props: { paddingLeft: number }) => (
5169
marginRight: '25px',
5270
}));
5371

72+
const StyledRemoveButton = styled.button({
73+
background: 'transparent',
74+
border: 'none',
75+
padding: 0,
76+
});
77+
78+
const StyledRemoveIcon = styled(ImageView)({
79+
[StyledRemoveButton + ':hover &']: {
80+
backgroundColor: colors.white80,
81+
},
82+
});
83+
5484
interface ICellListItemProps<T> {
5585
value: T;
5686
onSelect?: (application: T) => void;
@@ -64,18 +94,30 @@ function CellListItem<T>(props: ICellListItemProps<T>) {
6494
const onRemove = useCallback(() => props.onRemove?.(props.value), [props.onRemove, props.value]);
6595

6696
return (
67-
<Cell.CellButton onClick={props.onSelect ? onSelect : undefined}>
68-
<StyledLabel paddingLeft={props.paddingLeft}>{props.children}</StyledLabel>
69-
{props.onRemove && (
70-
<ImageView
71-
source="icon-close"
72-
width={22}
73-
height={22}
74-
onClick={onRemove}
75-
tintColor={colors.white60}
76-
tintHoverColor={colors.white80}
77-
/>
78-
)}
79-
</Cell.CellButton>
97+
<AriaDescriptionGroup>
98+
<StyledContainer>
99+
<StyledButton
100+
onClick={props.onSelect ? onSelect : undefined}
101+
as={props.onSelect ? 'button' : 'span'}>
102+
<AriaDescription>
103+
<StyledLabel paddingLeft={props.paddingLeft}>{props.children}</StyledLabel>
104+
</AriaDescription>
105+
</StyledButton>
106+
{props.onRemove && (
107+
<AriaDescribed>
108+
<StyledRemoveButton
109+
onClick={onRemove}
110+
aria-label={messages.pgettext('accessibility', 'Remove item')}>
111+
<StyledRemoveIcon
112+
source="icon-close"
113+
width={22}
114+
height={22}
115+
tintColor={colors.white60}
116+
/>
117+
</StyledRemoveButton>
118+
</AriaDescribed>
119+
)}
120+
</StyledContainer>
121+
</AriaDescriptionGroup>
80122
);
81123
}

0 commit comments

Comments
 (0)