From 4dd826a75f6ebc9ca6c35e0a95ee39a7351749a0 Mon Sep 17 00:00:00 2001 From: prince-pokharna Date: Tue, 16 Jun 2026 17:35:10 +0530 Subject: [PATCH] feat(ally) : add prefers-reduced-motion support --- src/app/globals.css | 17 ++++++++ src/app/layout.tsx | 51 +++++++++++++----------- src/components/layout/PageTransition.tsx | 15 ++++--- src/hooks/useReducedMotion.ts | 40 +++++++++++++++++++ src/utils/motionPreferences.ts | 0 5 files changed, 94 insertions(+), 29 deletions(-) create mode 100644 src/hooks/useReducedMotion.ts create mode 100644 src/utils/motionPreferences.ts diff --git a/src/app/globals.css b/src/app/globals.css index 4194d31d..786b838d 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -349,3 +349,20 @@ a { .markdown-body [width] { width: auto; } + +/* + ACCESSIBILITY: Respect prefers-reduced-motion OS preference + WCAG 2.3.3 — Animation from Interactions + This is a CSS-level safety net that works even before JS loads, + catching Tailwind animate classes and any CSS transitions. + */ +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + scroll-behavior: auto !important; + } +} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index e9a8aeee..2593bfc8 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -15,6 +15,7 @@ import 'github-markdown-css/github-markdown.css'; import PageTrackerInit from '@/components/PageTrackerInit'; import './globals.css'; import '@/styles/resume-print.css'; +import { MotionConfig } from 'framer-motion'; const inter = Inter({ subsets: ['latin'], variable: '--font-inter' }); const spaceGrotesk = Space_Grotesk({ @@ -123,30 +124,32 @@ export default function RootLayout({ className={`${inter.variable} ${spaceGrotesk.variable} ${barlowCondensed.variable}`} suppressHydrationWarning > - - - -