mirror of
https://github.com/wshobson/agents.git
synced 2026-03-18 17:47:16 +00:00
style: format all files with prettier
This commit is contained in:
@@ -34,12 +34,11 @@ Mobile accessibility ensures apps work for users with disabilities on iOS and An
|
||||
// Ensure adequate spacing between touch targets
|
||||
function ButtonGroup({ buttons }) {
|
||||
return (
|
||||
<div className="flex gap-3"> {/* 12px minimum gap */}
|
||||
<div className="flex gap-3">
|
||||
{" "}
|
||||
{/* 12px minimum gap */}
|
||||
{buttons.map((btn) => (
|
||||
<button
|
||||
key={btn.id}
|
||||
className="min-w-[44px] min-h-[44px] px-4 py-2"
|
||||
>
|
||||
<button key={btn.id} className="min-w-[44px] min-h-[44px] px-4 py-2">
|
||||
{btn.label}
|
||||
</button>
|
||||
))}
|
||||
@@ -66,7 +65,7 @@ function IconButton({ icon, label, onClick }) {
|
||||
### React Native Accessibility Props
|
||||
|
||||
```tsx
|
||||
import { View, Text, TouchableOpacity, AccessibilityInfo } from 'react-native';
|
||||
import { View, Text, TouchableOpacity, AccessibilityInfo } from "react-native";
|
||||
|
||||
// Basic accessible button
|
||||
function AccessibleButton({ onPress, title, hint }) {
|
||||
@@ -91,15 +90,15 @@ function ProductCard({ product }) {
|
||||
accessibilityLabel={`${product.name}, ${product.price}, ${product.rating} stars`}
|
||||
accessibilityRole="button"
|
||||
accessibilityActions={[
|
||||
{ name: 'activate', label: 'View details' },
|
||||
{ name: 'addToCart', label: 'Add to cart' },
|
||||
{ name: "activate", label: "View details" },
|
||||
{ name: "addToCart", label: "Add to cart" },
|
||||
]}
|
||||
onAccessibilityAction={(event) => {
|
||||
switch (event.nativeEvent.actionName) {
|
||||
case 'addToCart':
|
||||
case "addToCart":
|
||||
addToCart(product);
|
||||
break;
|
||||
case 'activate':
|
||||
case "activate":
|
||||
viewDetails(product);
|
||||
break;
|
||||
}
|
||||
@@ -356,11 +355,9 @@ function SwipeableCard({ item, onDelete }) {
|
||||
return (
|
||||
<View
|
||||
accessible={true}
|
||||
accessibilityActions={[
|
||||
{ name: 'delete', label: 'Delete item' },
|
||||
]}
|
||||
accessibilityActions={[{ name: "delete", label: "Delete item" }]}
|
||||
onAccessibilityAction={(event) => {
|
||||
if (event.nativeEvent.actionName === 'delete') {
|
||||
if (event.nativeEvent.actionName === "delete") {
|
||||
onDelete(item);
|
||||
}
|
||||
}}
|
||||
@@ -382,7 +379,7 @@ function SwipeableCard({ item, onDelete }) {
|
||||
<TouchableOpacity
|
||||
accessibilityLabel={`Delete ${item.title}`}
|
||||
onPress={() => onDelete(item)}
|
||||
style={{ position: 'absolute', right: 0 }}
|
||||
style={{ position: "absolute", right: 0 }}
|
||||
>
|
||||
<Text>Delete</Text>
|
||||
</TouchableOpacity>
|
||||
@@ -395,7 +392,7 @@ function SwipeableCard({ item, onDelete }) {
|
||||
|
||||
```tsx
|
||||
// Respect reduced motion preference
|
||||
import { AccessibilityInfo } from 'react-native';
|
||||
import { AccessibilityInfo } from "react-native";
|
||||
|
||||
function AnimatedComponent() {
|
||||
const [reduceMotion, setReduceMotion] = useState(false);
|
||||
@@ -404,8 +401,8 @@ function AnimatedComponent() {
|
||||
AccessibilityInfo.isReduceMotionEnabled().then(setReduceMotion);
|
||||
|
||||
const subscription = AccessibilityInfo.addEventListener(
|
||||
'reduceMotionChanged',
|
||||
setReduceMotion
|
||||
"reduceMotionChanged",
|
||||
setReduceMotion,
|
||||
);
|
||||
|
||||
return () => subscription.remove();
|
||||
@@ -414,9 +411,7 @@ function AnimatedComponent() {
|
||||
return (
|
||||
<Animated.View
|
||||
style={{
|
||||
transform: reduceMotion
|
||||
? []
|
||||
: [{ translateX: animatedValue }],
|
||||
transform: reduceMotion ? [] : [{ translateX: animatedValue }],
|
||||
opacity: reduceMotion ? 1 : animatedOpacity,
|
||||
}}
|
||||
>
|
||||
@@ -503,6 +498,7 @@ const scaledFontSize = (size: number) => {
|
||||
|
||||
```markdown
|
||||
## VoiceOver (iOS) Testing
|
||||
|
||||
- [ ] All interactive elements have labels
|
||||
- [ ] Swipe navigation covers all content in logical order
|
||||
- [ ] Custom actions available for complex interactions
|
||||
@@ -511,6 +507,7 @@ const scaledFontSize = (size: number) => {
|
||||
- [ ] Images have appropriate descriptions or are hidden
|
||||
|
||||
## TalkBack (Android) Testing
|
||||
|
||||
- [ ] Focus order is logical
|
||||
- [ ] Touch exploration works correctly
|
||||
- [ ] Custom actions available
|
||||
@@ -519,12 +516,14 @@ const scaledFontSize = (size: number) => {
|
||||
- [ ] Grouped content read together
|
||||
|
||||
## Motor Accessibility
|
||||
|
||||
- [ ] Touch targets at least 44x44 points
|
||||
- [ ] Adequate spacing between targets (8dp minimum)
|
||||
- [ ] Alternatives to complex gestures
|
||||
- [ ] No time-limited interactions
|
||||
|
||||
## Visual Accessibility
|
||||
|
||||
- [ ] Text scales to 200% without loss
|
||||
- [ ] Content visible in high contrast mode
|
||||
- [ ] Color not sole indicator
|
||||
|
||||
Reference in New Issue
Block a user