Skip to content

Commit ab9af9b

Browse files
Copilotrubensworks
andcommitted
Add accessibility improvements: guard for useEffect and respect prefers-reduced-motion
Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
1 parent e138649 commit ab9af9b

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

pages/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ export default function Home() {
55
useEffect(() => {
66
// Rotate SPARQL queries
77
const queries = document.querySelectorAll('.sparql-query');
8+
9+
if (queries.length === 0) {
10+
return;
11+
}
12+
813
let currentQuery = 0;
914

1015
const rotateQueries = () => {

styles/main.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,28 @@ main .date {
11551155
}
11561156
}
11571157

1158+
// Respect user motion preferences
1159+
@media (prefers-reduced-motion: reduce) {
1160+
* {
1161+
animation-duration: 0.01ms !important;
1162+
animation-iteration-count: 1 !important;
1163+
transition-duration: 0.01ms !important;
1164+
}
1165+
1166+
.source-types-scroll .source-types-track {
1167+
animation: none;
1168+
}
1169+
1170+
.hero-logo,
1171+
.hero-title,
1172+
.hero-subtitle,
1173+
.hero-buttons {
1174+
animation: none;
1175+
opacity: 1;
1176+
transform: none;
1177+
}
1178+
}
1179+
11581180
// Responsive adjustments for new index page
11591181
@media (max-width: 1020px) {
11601182
.hero {

0 commit comments

Comments
 (0)