Skip to content

Commit

Permalink
Merge pull request #274 from scottbenton/fix/improve-focus-active-ind…
Browse files Browse the repository at this point in the history
…icators

Fix/improve focus active indicators
  • Loading branch information
scottbenton authored Nov 1, 2023
2 parents dbe2ffd + fb2f193 commit 958ad3c
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@

### Accessibility

- Improved tab focus indicators

### Bug Fixes

- Fixed Planet Class not being properly set when creating new planets
- Fixed custom move and custom oracle ids not being created properly
- Fixed action rolls being able to go over a 10 on the d6.

## 2.0.0

Expand Down
8 changes: 0 additions & 8 deletions src/components/features/characters/StatComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@ export function StatComponent(props: StatComponentProps) {
outlineColor: theme.palette.primary.main,
borderColor: theme.palette.primary.main,
},
"&:focus-visible":
updateTrack || disableRoll
? {}
: {
outlineWidth: 2,
outlineColor: theme.palette.primary.main,
borderColor: theme.palette.primary.main,
},
}),

...(Array.isArray(sx) ? sx : [sx]),
Expand Down
6 changes: 6 additions & 0 deletions src/components/shared/Layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export function Header() {
focusRipple
LinkComponent={LinkComponent}
href={"/"}
className={"dark-focus-outline"}
sx={(theme) => ({
display: "flex",
alignItems: "center",
Expand Down Expand Up @@ -98,6 +99,7 @@ export function Header() {
sx={{ display: "inline" }}
>
<Button
className={"dark-focus-outline"}
color={"inherit"}
component={Link}
to={basePaths[BASE_ROUTES.CHARACTER]}
Expand All @@ -111,6 +113,7 @@ export function Header() {
Characters
</Button>
<Button
className={"dark-focus-outline"}
color={"inherit"}
component={Link}
to={basePaths[BASE_ROUTES.CAMPAIGN]}
Expand All @@ -124,6 +127,7 @@ export function Header() {
Campaigns
</Button>
<Button
className={"dark-focus-outline"}
color={"inherit"}
component={Link}
to={basePaths[BASE_ROUTES.WORLD]}
Expand All @@ -146,6 +150,7 @@ export function Header() {
color={"inherit"}
component={Link}
to={basePaths[BASE_ROUTES.LOGIN]}
className={"dark-focus-outline"}
>
Login
</Button>
Expand All @@ -154,6 +159,7 @@ export function Header() {
color={"primary"}
component={Link}
to={basePaths[BASE_ROUTES.SIGNUP]}
className={"dark-focus-outline"}
>
Create Account
</Button>
Expand Down
1 change: 1 addition & 0 deletions src/components/shared/Layout/HeaderMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export function HeaderMenu() {
<>
<ButtonBase
sx={{ borderRadius: "100%", ml: 2 }}
className={"dark-focus-outline"}
aria-label={"User Settings Menu Toggle"}
focusRipple
ref={anchorRef}
Expand Down
3 changes: 3 additions & 0 deletions src/pages/Home/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function HomePage() {
</Typography>
{isLoggedIn ? (
<Button
className={"dark-focus-outline"}
color={"primary"}
variant={"contained"}
component={Link}
Expand All @@ -65,13 +66,15 @@ export function HomePage() {
) : (
<Stack direction={"row"} spacing={1} mt={4}>
<Button
className={"dark-focus-outline"}
color={"inherit"}
component={Link}
to={basePaths[BASE_ROUTES.LOGIN]}
>
Login
</Button>
<Button
className={"dark-focus-outline"}
variant={"contained"}
color={"primary"}
component={Link}
Expand Down
20 changes: 20 additions & 0 deletions src/providers/ThemeProvider/themes/ironsworn-dark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,25 @@ export const ironswornDarkTheme = createTheme({
},
},
},
MuiButton: {
styleOverrides: {
root: ({ ownerState, theme }) => {
return {
"&.Mui-focusVisible": {
boxShadow: `inset 0 0 0 2px ${theme.palette.info.light}, 0 0 0 2px ${theme.palette.info.light}`,
},
};
},
},
},
MuiButtonBase: {
styleOverrides: {
root: ({ ownerState, theme }) => ({
"&.Mui-focusVisible": {
boxShadow: `inset 0 0 0 2px ${theme.palette.info.light}, 0 0 0 2px ${theme.palette.info.light}`,
},
}),
},
},
},
});
26 changes: 26 additions & 0 deletions src/providers/ThemeProvider/themes/ironsworn-light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,31 @@ export const ironswornLightTheme = createTheme({
},
},
},
MuiButton: {
styleOverrides: {
root: ({ ownerState, theme }) => {
return {
"&.Mui-focusVisible": {
boxShadow: `inset 0 0 0 2px ${theme.palette.info.main}, 0 0 0 2px ${theme.palette.info.main}`,
"&.dark-focus-outline": {
boxShadow: `inset 0 0 0 2px ${theme.palette.info.light}, 0 0 0 2px ${theme.palette.info.light}`,
},
},
};
},
},
},
MuiButtonBase: {
styleOverrides: {
root: ({ ownerState, theme }) => ({
"&.Mui-focusVisible": {
boxShadow: `inset 0 0 0 2px ${theme.palette.info.main}, 0 0 0 2px ${theme.palette.info.main}`,
"&.dark-focus-outline": {
boxShadow: `inset 0 0 0 2px ${theme.palette.info.light}, 0 0 0 2px ${theme.palette.info.light}`,
},
},
}),
},
},
},
});
20 changes: 20 additions & 0 deletions src/providers/ThemeProvider/themes/starforged-dark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,25 @@ export const starforgedDarkTheme = createTheme({
},
},
},
MuiButton: {
styleOverrides: {
root: ({ ownerState, theme }) => {
return {
"&.Mui-focusVisible": {
boxShadow: `inset 0 0 0 2px ${theme.palette.info.light}, 0 0 0 2px ${theme.palette.info.light}`,
},
};
},
},
},
MuiButtonBase: {
styleOverrides: {
root: ({ ownerState, theme }) => ({
"&.Mui-focusVisible": {
boxShadow: `inset 0 0 0 2px ${theme.palette.info.light}, 0 0 0 2px ${theme.palette.info.light}`,
},
}),
},
},
},
});
27 changes: 27 additions & 0 deletions src/providers/ThemeProvider/themes/starforged-light.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { baseFontFamilies, sharedStatusColors } from "./constants-shared";
import { starforgedGold, starforgedGrey } from "./constants-starforged";
import { HexboxUnchecked } from "assets/HexboxUnchecked";
import { HexboxChecked } from "assets/HexboxChecked";
import { ironswornPink } from "./constants-ironsworn";

export const starforgedLightTheme = createTheme({
palette: {
Expand Down Expand Up @@ -54,5 +55,31 @@ export const starforgedLightTheme = createTheme({
},
},
},
MuiButton: {
styleOverrides: {
root: ({ ownerState, theme }) => {
return {
"&.Mui-focusVisible": {
boxShadow: `inset 0 0 0 2px ${theme.palette.info.main}, 0 0 0 2px ${theme.palette.info.main}`,
"&.dark-focus-outline": {
boxShadow: `inset 0 0 0 2px ${theme.palette.info.light}, 0 0 0 2px ${theme.palette.info.light}`,
},
},
};
},
},
},
MuiButtonBase: {
styleOverrides: {
root: ({ ownerState, theme }) => ({
"&.Mui-focusVisible": {
boxShadow: `inset 0 0 0 2px ${theme.palette.info.main}, 0 0 0 2px ${theme.palette.info.main}`,
"&.dark-focus-outline": {
boxShadow: `inset 0 0 0 2px ${theme.palette.info.light}, 0 0 0 2px ${theme.palette.info.light}`,
},
},
}),
},
},
},
});

0 comments on commit 958ad3c

Please sign in to comment.