Skip to content

Commit 49403b7

Browse files
authored
Merge pull request #2299 from gordon-cs/s24-login-page-accessibility
Improve Login/Home Page Accessibility
2 parents 5e6716d + bcd74cb commit 49403b7

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/components/Header/index.jsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,28 @@ const useTabHighlight = () => {
5757
return tabIndex;
5858
};
5959

60+
const useAltText = () => {
61+
const location = useLocation();
62+
const [altText, setAltText] = useState('');
63+
64+
useEffect(() => {
65+
if (location.pathname === '/') {
66+
setAltText('Gordon 360 Logo - Home page');
67+
} else {
68+
setAltText('Gordon 360 Logo - Go to home');
69+
}
70+
}, [location]);
71+
72+
return altText;
73+
};
74+
6075
const GordonHeader = ({ onDrawerToggle }) => {
6176
const navigate = useNavigate();
6277
const [dialog, setDialog] = useState('');
6378
const isOnline = useNetworkStatus();
6479
const isAuthenticated = useIsAuthenticated();
6580
const tabIndex = useTabHighlight();
81+
const altText = useAltText();
6682

6783
const handleOpenProfile = () => {
6884
navigate('/myprofile');
@@ -148,7 +164,7 @@ const GordonHeader = ({ onDrawerToggle }) => {
148164
<source srcSet={headerLogo72dpi} media="(min-width: 900px)" />
149165
<source srcSet={headerLogo64dpi} media="(min-width: 600px)" />
150166
<source srcSet={headerLogo56dpiNoText} media="(max-width: 375px)" />
151-
<img src={headerLogo56dpi} alt="Gordon 360 Logo"></img>
167+
<img src={headerLogo56dpi} alt={altText}></img>
152168
</picture>
153169
</Link>
154170
</div>

src/views/Home/components/GuestWelcome/index.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ const GuestWelcome = () => {
7474
<Grid container style={{ textAlign: 'center' }}>
7575
<Card raised className={styles.gw_card}>
7676
<CardHeader title="Welcome to Gordon 360!" />
77-
<CardMedia image={GordonLogoVerticalWhite} component="img" />
77+
<CardMedia
78+
image={GordonLogoVerticalWhite}
79+
component="img"
80+
alt="Welcome to Gordon 360"
81+
/>
7882
<CardContent>
7983
<Typography>
8084
As a guest, you have access to a limited view of the site. Login for full access.

0 commit comments

Comments
 (0)