Skip to content

Commit

Permalink
fix(a11y): Colour contrast issues (#2981)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianjon3s authored Apr 5, 2024
1 parent 2c53f38 commit 2554ee9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
4 changes: 3 additions & 1 deletion editor.planx.uk/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const DEFAULT_PALETTE: Partial<PaletteOptions> = {
text: {
primary: "#0B0C0C",
secondary: "#505A5F",
placeholder: "#68787D",
},
link: {
main: DEFAULT_PRIMARY_COLOR,
Expand All @@ -60,6 +61,7 @@ const DEFAULT_PALETTE: Partial<PaletteOptions> = {
},
success: {
main: "#4CAF50",
dark: "#265A26",
},
info: {
main: "#2196F3",
Expand Down Expand Up @@ -484,7 +486,7 @@ const generateTeamTheme = (
linkColour: DEFAULT_PRIMARY_COLOR,
logo: null,
favicon: null,
}
},
): MUITheme => {
const themeOptions = getThemeOptions(teamTheme);
const theme = responsiveFontSizes(createTheme(themeOptions), { factor: 3 });
Expand Down
14 changes: 14 additions & 0 deletions editor.planx.uk/src/themeOverrides.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ declare module "@mui/material/styles/createPalette" {
dark: string;
};
}

interface TypeText {
primary: string;
secondary: string;
disabled: string;
placeholder: string;
}

interface TypeTextOptions {
primary: string;
secondary: string;
disabled: string;
placeholder: string;
}
}

// Append our custom variants to MUI Button
Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/ui/editor/RichTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export const RichContentContainer = styled(Box)(({ theme }) => ({
},
// Styles for placeholder text, to match ui/Input.tsx
"& p.is-editor-empty:nth-child(1)::before": {
color: theme.palette.text.secondary,
opacity: "0.5",
color: theme.palette.text.placeholder,
opacity: 1,
content: `attr(data-placeholder)`,
float: "left",
height: 0,
Expand Down
6 changes: 3 additions & 3 deletions editor.planx.uk/src/ui/shared/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ const StyledInputBase = styled(InputBase, {
"& input": {
fontWeight: "inherit",
},
"& ::placeholder": {
color: theme.palette.text.secondary,
opacity: "0.5",
"& input::placeholder, & textarea::placeholder": {
color: theme.palette.text.placeholder,
opacity: 1,
},
...(bordered && {
border: `2px solid ${theme.palette.text.primary}`,
Expand Down

0 comments on commit 2554ee9

Please sign in to comment.