From 87dd578e92981c53629f7a711f9d9f67f7ef06a9 Mon Sep 17 00:00:00 2001 From: TypoGenie Date: Wed, 18 Feb 2026 23:52:06 +0200 Subject: [PATCH] a11y: add error boundary, reduced motion, remaining fixes --- src/App.tsx | 15 ++++++----- src/components/ErrorBoundary.tsx | 43 ++++++++++++++++++++++++++++++++ src/components/StyleSelector.tsx | 2 +- src/main.tsx | 5 +++- 4 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 src/components/ErrorBoundary.tsx diff --git a/src/App.tsx b/src/App.tsx index 5621968..b5259d0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect, useCallback } from 'react'; -import { motion, AnimatePresence } from 'motion/react'; +import { motion, AnimatePresence, useReducedMotion } from 'motion/react'; import { AppState, PaperSize } from './types'; import { FileUpload } from './components/FileUpload'; import { StyleSelector } from './components/StyleSelector'; @@ -82,6 +82,7 @@ const KeyboardShortcutsHelp: React.FC<{ isOpen: boolean; onClose: () => void }> }; const App: React.FC = () => { + const prefersReducedMotion = useReducedMotion(); const [appState, setAppState] = useState(AppState.UPLOAD); const [content, setContent] = useState(''); const [inputFileName, setInputFileName] = useState(''); @@ -276,6 +277,8 @@ const App: React.FC = () => { ? + setShowShortcuts(true)} role="button" aria-label="Show keyboard shortcuts">? + {appState !== AppState.UPLOAD && ( { -

{style.description}

+

{style.description}

diff --git a/src/main.tsx b/src/main.tsx index bce7f44..f6d0ae2 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,6 +1,7 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import App from './App'; +import { ErrorBoundary } from './components/ErrorBoundary'; import './index.css'; const rootElement = document.getElementById('root'); @@ -11,6 +12,8 @@ if (!rootElement) { const root = ReactDOM.createRoot(rootElement); root.render( - + + + );