Skip to content

Commit 957996f

Browse files
Alex Bilozorclaude
andcommitted
perf: Optimize masonry animation performance and accessibility
CSS improvements: - Namespaced keyframes to atw-scroll-up to avoid conflicts - Added will-change and backface-visibility for GPU optimization - Improved animation performance to reduce paint jank Accessibility improvements: - Added aria-hidden="true" to decorative image grids - Prevents screen readers from announcing decorative images Visual improvements: - Added staggered animation delay per column (0s, -5s, -10s, -15s) - Creates more natural, desynchronized scrolling effect Addresses all CSS-related PR review feedback. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent be054ac commit 957996f

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

app/src/app/globals.css

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@
186186
border-color: var(--brand-orange);
187187
}
188188

189-
/* Masonry scroll animations */
190-
@keyframes scroll-up {
189+
/* Masonry scroll animations - namespaced to avoid conflicts */
190+
@keyframes atw-scroll-up {
191191
0% {
192192
transform: translateY(0);
193193
}
@@ -197,23 +197,33 @@
197197
}
198198

199199
.animate-scroll-slow {
200-
animation: scroll-up 80s linear infinite;
200+
animation: atw-scroll-up 80s linear infinite;
201+
will-change: transform;
202+
backface-visibility: hidden;
201203
}
202204

203205
.animate-scroll-medium {
204-
animation: scroll-up 70s linear infinite;
206+
animation: atw-scroll-up 70s linear infinite;
207+
will-change: transform;
208+
backface-visibility: hidden;
205209
}
206210

207211
.animate-scroll-fast {
208-
animation: scroll-up 60s linear infinite;
212+
animation: atw-scroll-up 60s linear infinite;
213+
will-change: transform;
214+
backface-visibility: hidden;
209215
}
210216

211217
.animate-scroll-slower {
212-
animation: scroll-up 90s linear infinite;
218+
animation: atw-scroll-up 90s linear infinite;
219+
will-change: transform;
220+
backface-visibility: hidden;
213221
}
214222

215223
.animate-scroll-faster {
216-
animation: scroll-up 50s linear infinite;
224+
animation: atw-scroll-up 50s linear infinite;
225+
will-change: transform;
226+
backface-visibility: hidden;
217227
}
218228

219229
@media (prefers-reduced-motion: reduce) {

app/src/app/page.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,12 @@ function LandingHero({ images }: { images: Image[] }) {
301301
return (
302302
<section className="relative w-full h-[80vh] overflow-hidden">
303303
{/* Desktop Layout - 4 columns */}
304-
<div className="absolute inset-0 hidden lg:grid grid-cols-4 gap-1">
304+
<div className="absolute inset-0 hidden lg:grid grid-cols-4 gap-1" aria-hidden="true">
305305
{desktopColumns.map((columnImages, columnIndex) => (
306306
<div
307307
key={`desktop-column-${columnIndex}`}
308308
className={`flex flex-col gap-1 ${animationSpeeds[columnIndex]}`}
309+
style={{ animationDelay: `${-(columnIndex * 5)}s` }}
309310
>
310311
{/* First set of images */}
311312
{columnImages.map((image, index) => (
@@ -349,11 +350,12 @@ function LandingHero({ images }: { images: Image[] }) {
349350
</div>
350351

351352
{/* Tablet Layout - 3 columns */}
352-
<div className="absolute inset-0 hidden md:grid lg:hidden grid-cols-3 gap-1">
353+
<div className="absolute inset-0 hidden md:grid lg:hidden grid-cols-3 gap-1" aria-hidden="true">
353354
{tabletColumns.map((columnImages, columnIndex) => (
354355
<div
355356
key={`tablet-column-${columnIndex}`}
356357
className={`flex flex-col gap-1 ${animationSpeeds[columnIndex]}`}
358+
style={{ animationDelay: `${-(columnIndex * 5)}s` }}
357359
>
358360
{/* First set of images */}
359361
{columnImages.map((image, index) => (
@@ -397,11 +399,12 @@ function LandingHero({ images }: { images: Image[] }) {
397399
</div>
398400

399401
{/* Mobile Layout - 2 columns */}
400-
<div className="absolute inset-0 grid md:hidden grid-cols-2 gap-1">
402+
<div className="absolute inset-0 grid md:hidden grid-cols-2 gap-1" aria-hidden="true">
401403
{mobileColumns.map((columnImages, columnIndex) => (
402404
<div
403405
key={`mobile-column-${columnIndex}`}
404406
className={`flex flex-col gap-1 ${animationSpeeds[columnIndex]}`}
407+
style={{ animationDelay: `${-(columnIndex * 5)}s` }}
405408
>
406409
{/* First set of images */}
407410
{columnImages.map((image, index) => (

0 commit comments

Comments
 (0)