**Introduction** When you target both web and native mobile platforms with React, maintaining a consistent user experience becomes crucial. Accessibility is one area where inconsistency can alienate a significant portion of your audience. A unified accessibility strategy helps ensure that every user, regardless of ability, can interact with your app effectively across devices. **Why Accessibility Matters** - Over 1 billion people worldwide live with some form of disability. - Accessible applications often rank higher in SEO and receive better engagement metrics. - Legal frameworks (e.g., WCAG 2.2, ADA, EUAA) set baseline expectations for digital products. **Core Principles for Cross‑Platform Accessibility** 1. **Semantic Markup** – Use native HTML elements on the web and corresponding accessibility traits in React Native. 2. **Keyboard Navigation** – Provide a logical tab order and focus management that works on both keyboard and screen‑reader inputs. 3. **Screen‑Reader Support** – Leverage `accessibilityLabel`, `accessibilityRole`, and `accessibilityState` on React Native, and proper ARIA attributes on the web. 4. **High‑Contrast & Scalable Text** – Define CSS classes for dark themes and use responsive font sizes that adapt to system settings. 5. **Testing Automation** – Integrate tools like `axe-core` for web and `react-native-a11y` for mobile into CI pipelines. **Implementation Steps** - **Create a Shared Design System** – Document accessible component states (hover, focus, disabled) in a design token library that can be imported into both React Web and React Native codebases. - **Centralize Accessibility Logic** – Build a custom hook such as `useAccessibility` that returns platform‑specific props. Example: ```js const useAccessibility = (label, role) => { if (Platform.OS === 'web') { return { 'aria-label': label, role }; } return { accessibilityLabel: label, accessibilityRole: role }; }; ``` - **Add Focus Management** – Use `useRef` to store focusable elements and a helper function to move focus programmatically when navigating between screens. - **Leverage TypeScript Types** – Define a unified `AccessibilityProps` interface so TypeScript enforces correct usage across projects. **Real‑World Example: Accessible Button Component** ```jsx // shared/AccessibleButton.tsx import React from 'react'; import { Platform, Pressable, Text } from 'react-native'; import { TouchableOpacity } from 'react-native-web'; // for web support interface AccessibilityProps { label: string; hinted?: boolean; } const AccessibleButton: React.FC<{children: React.ReactNode} & AccessibilityProps> = ({children, label, hinted}) => { const webProps = Platform.OS === 'web' ? {as: TouchableOpacity, 'aria-label': label, 'aria-describedby': hinted ? 'hint' : undefined} : {}; const nativeProps = { accessibilityLabel: label, accessibilityRole: 'button', accessibilityState: hinted ? {disabled: true} : undefined, }; return ( <Pressable {...webProps} {...nativeProps} style={{padding: 12, backgroundColor: '#007bff', borderRadius: 4}}> <Text style={{color: '#fff'}}>{children}</Text> </Pressable> ); }; ``` This component automatically applies the correct attributes for both platforms, ensuring screen readers announce the button label and keyboard users can trigger it reliably. **Testing and Validation** - Run `npm test` with `jest` and `react-native-testing-library` to automate accessibility checks. - Manually test with iOS VoiceOver, Android TalkBack, and browser screen readers (NVDA, VoiceOver, TalkBack). - Useaxe‑core in CI to catch violations early in pull requests. **Conclusion** A shared accessibility strategy not only simplifies development but also future‑proofs your React applications against evolving regulations and user expectations. By centralizing semantic markup, focus handling, and testing, you can deliver an inclusive experience that feels native—whether the user is on a laptop, tablet, or phone. --- *Remember: Accessibility is a journey, not a checklist. Keep iterating, gather user feedback, and let those insights drive continuous improvement.*