Skip to content

Commit 9f9fae9

Browse files
committed
✨(frontend) unify tab focus style for better visual consistency
standardizes keyboard focus appearance to improve UI coherence Signed-off-by: Cyril <c.gromoff@gmail.com>
1 parent 9cb2b6a commit 9f9fae9

File tree

8 files changed

+49
-36
lines changed

8 files changed

+49
-36
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ and this project adheres to
88

99
## [Unreleased]
1010

11-
### Added
11+
- ⚡️(frontend) improve accessibility:
12+
- #1341
13+
14+
### Added
1215

1316
- ✨(api) add API route to fetch document content #1206
1417

src/frontend/apps/impress/src/components/DropButton.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,18 @@ const StyledButton = styled(Button)<StyledButtonProps>`
2828
border: none;
2929
background: none;
3030
outline: none;
31-
transition: all 0.2s ease-in-out;
3231
font-weight: 500;
3332
font-size: 0.938rem;
3433
padding: 0;
3534
${({ $css }) => $css};
36-
35+
&:hover {
36+
background-color: var(
37+
--c--components--button--primary-text--background--color-hover
38+
);
39+
}
3740
&:focus-visible {
38-
outline: 2px solid var(--c--theme--colors--primary-500);
39-
outline-offset: 2px;
41+
box-shadow: 0 0 0 2px var(--c--theme--colors--primary-400);
4042
border-radius: 4px;
41-
transition: none;
4243
}
4344
`;
4445

src/frontend/apps/impress/src/components/dropdown-menu/DropdownMenu.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,13 @@ export const DropdownMenu = ({
207207
}
208208
209209
&:focus-visible {
210-
outline: 2px solid var(--c--theme--colors--primary-500);
210+
outline: 2px solid var(--c--theme--colors--primary-400);
211211
outline-offset: -2px;
212212
background-color: var(--c--theme--colors--greyscale-050);
213213
}
214214
215215
${isFocused &&
216216
css`
217-
outline: 2px solid var(--c--theme--colors--primary-500);
218217
outline-offset: -2px;
219218
background-color: var(--c--theme--colors--greyscale-050);
220219
`}

src/frontend/apps/impress/src/features/auth/components/ButtonLogin.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { Button } from '@openfun/cunningham-react';
22
import { useTranslation } from 'react-i18next';
33
import { css } from 'styled-components';
44

5-
import { BoxButton } from '@/components';
5+
import { Box, BoxButton } from '@/components';
6+
import { useCunninghamTheme } from '@/cunningham';
67

78
import ProConnectImg from '../assets/button-proconnect.svg';
89
import { useAuth } from '../hooks';
@@ -11,6 +12,7 @@ import { gotoLogin, gotoLogout } from '../utils';
1112
export const ButtonLogin = () => {
1213
const { t } = useTranslation();
1314
const { authenticated } = useAuth();
15+
const { colorsTokens } = useCunninghamTheme();
1416

1517
if (!authenticated) {
1618
return (
@@ -26,14 +28,23 @@ export const ButtonLogin = () => {
2628
}
2729

2830
return (
29-
<Button
30-
onClick={gotoLogout}
31-
color="primary-text"
32-
aria-label={t('Logout')}
33-
className="--docs--button-logout"
31+
<Box
32+
$css={css`
33+
.--docs--button-logout:focus-visible {
34+
box-shadow: 0 0 0 2px ${colorsTokens['primary-400']} !important;
35+
border-radius: 4px;
36+
}
37+
`}
3438
>
35-
{t('Logout')}
36-
</Button>
39+
<Button
40+
onClick={gotoLogout}
41+
color="primary-text"
42+
aria-label={t('Logout')}
43+
className="--docs--button-logout"
44+
>
45+
{t('Logout')}
46+
</Button>
47+
</Box>
3748
);
3849
};
3950

src/frontend/apps/impress/src/features/header/components/Header.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ export const Header = () => {
4343
href="/"
4444
data-testid="header-logo-link"
4545
aria-label={t('Back to homepage')}
46+
$css={css`
47+
outline: none;
48+
&:focus-visible {
49+
box-shadow: 0 0 0 2px var(--c--theme--colors--primary-400) !important;
50+
border-radius: 4px;
51+
}
52+
`}
4653
>
4754
<Box
4855
$align="center"

src/frontend/apps/impress/src/features/language/components/LanguagePicker.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,7 @@ export const LanguagePicker = () => {
4141
showArrow
4242
label={t('Select language')}
4343
buttonCss={css`
44-
&:hover {
45-
background-color: var(
46-
--c--components--button--primary-text--background--color-hover
47-
);
48-
}
49-
&:focus-visible {
50-
outline: 2px solid var(--c--theme--colors--primary-500);
51-
outline-offset: 2px;
52-
}
44+
transition: all 0.15s ease-in-out !important;
5345
border-radius: 4px;
5446
padding: 0.5rem 0.6rem;
5547
& > div {

src/frontend/apps/impress/src/features/left-panel/components/LefPanelTargetFilters.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ export const LeftPanelTargetFilters = () => {
8585
background-color: ${colorsTokens['greyscale-100']};
8686
}
8787
&:focus-visible {
88-
outline: 2px solid ${colorsTokens['primary-500']};
89-
outline-offset: 2px;
88+
outline: none !important;
89+
box-shadow: 0 0 0 2px ${colorsTokens['primary-500']} !important;
90+
border-radius: 4px;
9091
}
9192
`}
9293
>

src/frontend/apps/impress/src/features/left-panel/components/LeftPanelFavoriteItem.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,26 @@ export const LeftPanelFavoriteItem = ({ doc }: LeftPanelFavoriteItemProps) => {
3131
.pinned-actions {
3232
opacity: ${isDesktop ? 0 : 1};
3333
}
34-
&:hover,
34+
&:hover {
35+
background-color: ${colorsTokens['greyscale-100']};
36+
}
3537
&:focus-within {
3638
cursor: pointer;
37-
38-
background-color: var(--c--theme--colors--greyscale-100);
39+
box-shadow: 0 0 0 2px ${colorsTokens['primary-500']} !important;
3940
.pinned-actions {
4041
opacity: 1;
4142
}
4243
}
43-
&:focus-visible {
44-
outline: 2px solid ${colorsTokens['primary-500']};
45-
outline-offset: 2px;
46-
border-radius: ${spacingsTokens['3xs']};
47-
}
4844
`}
4945
key={doc.id}
5046
className="--docs--left-panel-favorite-item"
5147
>
5248
<StyledLink
5349
href={`/docs/${doc.id}`}
54-
$css="overflow: auto;"
50+
$css={css`
51+
overflow: auto;
52+
outline: none !important;
53+
`}
5554
aria-label={`${doc.title}, ${t('Updated')} ${DateTime.fromISO(doc.updated_at).toRelative()}`}
5655
>
5756
<SimpleDocItem showAccesses doc={doc} />

0 commit comments

Comments
 (0)