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

FI-2077: Improve colors and contrasts for a11y #392

Merged
merged 6 commits into from
Sep 12, 2023
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
1 change: 1 addition & 0 deletions client/src/components/InputsModal/InputCheckboxGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const InputCheckboxGroup: FC<InputCheckboxGroupProps> = ({
control={
<Checkbox
size="small"
color="secondary"
name={option.value}
checked={values[option.value as keyof CheckboxValues] || false}
onChange={handleChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ const InputOAuthCredentials: FC<InputOAuthCredentialsProps> = ({
value={oAuthCredentials[field.name as keyof OAuthCredentials]}
className={classes.inputField}
variant="standard"
color="secondary"
fullWidth
onChange={(event) => {
const value = event.target.value;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/InputsModal/InputRadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const InputRadioGroup: FC<InputRadioGroupProps> = ({
{requirement.options?.list_options?.map((option, i) => (
<FormControlLabel
value={option.value}
control={<Radio size="small" />}
control={<Radio size="small" color="secondary" />}
label={option.label}
key={`radio-button-${i}`}
/>
Expand Down
1 change: 1 addition & 0 deletions client/src/components/InputsModal/InputTextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const InputTextArea: FC<InputTextAreaProps> = ({ requirement, index, inputsMap,
id={`requirement${index}_input`}
className={classes.inputField}
variant="standard"
color="secondary"
fullWidth
label={<FieldLabel requirement={requirement} />}
helperText={requirement.description}
Expand Down
1 change: 1 addition & 0 deletions client/src/components/InputsModal/InputTextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const InputTextField: FC<InputTextFieldProps> = ({
id={`requirement${index}_input`}
className={classes.inputField}
variant="standard"
color="secondary"
fullWidth
label={<FieldLabel requirement={requirement} />}
helperText={requirement.description}
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/InputsModal/InputsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ const InputsModal: FC<InputsModalProps> = ({
input: classes.serialInput,
},
}}
color="secondary"
fullWidth
multiline
data-testid="serial-input"
Expand Down Expand Up @@ -399,7 +400,7 @@ const InputsModal: FC<InputsModalProps> = ({
color="secondary"
data-testid="cancel-button"
onClick={() => closeModal()}
sx={{ mr: 1 }}
sx={{ mr: 1, fontWeight: 'bold' }}
>
Cancel
</Button>
Expand All @@ -409,6 +410,7 @@ const InputsModal: FC<InputsModalProps> = ({
disableElevation
onClick={submitClicked}
disabled={missingRequiredInput || invalidInput}
sx={{ fontWeight: 'bold' }}
>
Submit
</Button>
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/InputsModal/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default makeStyles()((theme: Theme) => ({
color: theme.palette.common.grayDarkest,
},
'& label.Mui-focused': {
color: theme.palette.common.orangeDarkest,
color: theme.palette.secondary.main,
},
'& label.Mui-disabled': {
color: theme.palette.common.gray,
Expand All @@ -36,7 +36,7 @@ export default makeStyles()((theme: Theme) => ({
margin: '8px 0',
borderColor: theme.palette.common.grayLight,
'&:focus-within': {
borderColor: theme.palette.primary.main,
borderColor: theme.palette.secondary.main,
},
},
serialInput: {
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/PresetsSelector/PresetsSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const PresetsSelector: FC<PresetsModalProps> = ({ presets, testSessionId, getSes
<DialogActions>
<Button
data-testid="preset-cancel-button"
sx={{ color: theme.palette.primary.dark }}
sx={{ color: theme.palette.primary.dark, fontWeight: 'bold' }}
onClick={() => {
setSelectedPreset(formerPreset);
setModalVisible(false);
Expand All @@ -119,7 +119,7 @@ const PresetsSelector: FC<PresetsModalProps> = ({ presets, testSessionId, getSes
</Button>
<Button
data-testid="preset-apply-button"
sx={{ color: theme.palette.primary.dark }}
sx={{ color: theme.palette.primary.dark, fontWeight: 'bold' }}
onClick={() => {
applyPresetToSession(presetTitleToIdMap[selectedPreset]);
setFormerPreset(selectedPreset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ const RequestDetailModal: FC<RequestDetailModalProps> = ({
variant="contained"
data-testid="cancel-button"
onClick={hideModal}
sx={{ fontWeight: 'bold' }}
>
Close
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const ResultIcon: FC<ResultIconProps> = ({ result, isRunning }) => {
<Cancel
tabIndex={0}
aria-hidden="false"
style={{ color: result.optional ? grey[500] : red[500] }}
style={{ color: result.optional ? grey[500] : red[700] }}
data-testid={`${result.id}-${result.result}`}
/>
</CustomTooltip>
Expand All @@ -64,7 +64,7 @@ const ResultIcon: FC<ResultIconProps> = ({ result, isRunning }) => {
<Cancel
tabIndex={0}
aria-hidden="false"
style={{ color: result.optional ? grey[500] : red[500] }}
style={{ color: result.optional ? grey[500] : red[700] }}
data-testid={`${result.id}-${result.result}`}
/>
</CustomTooltip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,11 @@ const TestListItem: FC<TestListItemProps> = ({
TransitionProps={{ unmountOnExit: true }}
onClick={handleAccordionClick}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
if (e.key === 'Enter') {
// Don't open/close accordion on enter
setTabIndex(findPopulatedTabIndex());
}
if (e.key === ' ') {
handleAccordionClick();
}
}}
Expand Down
1 change: 1 addition & 0 deletions client/src/components/_common/ActionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const ActionModal: FC<ActionModalProps> = ({ modalVisible, message, cancelTestRu
disableElevation
onClick={cancelTestRun}
data-testid="cancel-button"
sx={{ fontWeight: 'bold' }}
>
Cancel
</Button>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/_common/CustomTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface CustomTabProps {
const CustomTab = styled((props: CustomTabProps) => <Tab disableRipple {...props} />)(
({ theme }) => ({
pointerEvents: 'auto',
fontWeight: 'bolder',
fontWeight: 'bold',
'&:hover, :focus-within': {
color: theme.palette.common.grayDarkest,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Box, FormControl, FormControlLabel, FormLabel, Radio, RadioGroup } from
import HelpOutlineOutlinedIcon from '@mui/icons-material/HelpOutlineOutlined';
import { RadioOption, RadioOptionSelection } from '~/models/selectionModels';
import CustomTooltip from '~/components/_common/CustomTooltip';
import useStyles from '~/components/_common/SelectionPanel/styles';

export interface RadioSelectionProps {
options: RadioOption[];
Expand All @@ -13,6 +14,7 @@ const RadioSelection: FC<RadioSelectionProps> = ({
options,
setSelections: setParentSelections,
}) => {
const { classes } = useStyles();
const initialSelectedRadioOptions: RadioOptionSelection[] = options.map((option) => ({
// just grab the first to start
// perhaps choices should be persisted in the URL to make it easy to share specific options
Expand All @@ -39,7 +41,12 @@ const RadioSelection: FC<RadioSelectionProps> = ({
return (
<Box px={4} py={2}>
{options.map((option, i) => (
<FormControl fullWidth id={`radio-input-${i}`} key={`radio-form-control${i}`}>
<FormControl
fullWidth
id={`radio-input-${i}`}
key={`radio-form-control${i}`}
className={classes.label}
>
<FormLabel sx={{ display: 'flex', alignItems: 'center' }}>
{option.title || option.id}
{option.description && (
Expand Down
5 changes: 5 additions & 0 deletions client/src/components/_common/SelectionPanel/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import { Theme } from '@mui/material/styles';
import { makeStyles } from 'tss-react/mui';

export default makeStyles()((theme: Theme) => ({
label: {
'& label.Mui-focused': {
color: theme.palette.common.orangeDarkest,
},
},
optionsList: {
display: 'flex',
flexDirection: 'column',
Expand Down
12 changes: 12 additions & 0 deletions client/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,16 @@ body {
overscroll-behavior-y: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

/* Keyboard-only focus indicator */
button:focus-visible {
border: 1px solid #707070;
}

/* Darken button backgrounds on hover on text styled buttons */
button:hover {
&.MuiButton-text {
background-color: #cbd5df60;
}
}