Prefers-Reduced-Motion Support
Lumidot automatically detects and responds to the user’sprefers-reduced-motion system preference using the useReducedMotion hook.
The useReducedMotion Hook
Implemented inindex.tsx:226-239:
How It Works
- Media Query Listening: Uses
window.matchMediato check the system preference - Dynamic Updates: Listens for changes and updates in real-time
- Conditional Activation: Only enabled for sequence mode animations (
enabledparameter)
When Reduced Motion Is Active
The hook is only used for sequence mode patterns:corners-onlyplus-hollowspiral
Behavior with Reduced Motion
Whenprefers-reduced-motion: reduce is detected:
Sequence Mode
All frames display simultaneously instead of animating:Wave Mode
Wave mode patterns continue to display normally, as CSS animations are considered less disruptive than JavaScript-driven frame sequences.Testing Reduced Motion
- macOS
- Windows
- Browser DevTools
- Open System Preferences
- Go to Accessibility → Display
- Enable “Reduce motion”
Example: Testing Reduced Motion
ARIA Attributes
Lumidot includes proper ARIA attributes for screen reader compatibility.Role and Label
Every Lumidot component has:index.tsx:350-354:
What This Means
role="status": Indicates this is a status update regionaria-label="Loading": Provides a text description for screen readers
Custom Labels
While Lumidot doesn’t expose anaria-label prop, you can wrap it in a container with a custom label:
Data Attributes
Lumidot adds semantic data attributes for debugging and styling:Custom Styling
Testing
Test ID Support
Lumidot accepts atestId prop for testing:
Testing Example
Dot-Level Data Attributes
Each individual dot has data attributes:Usage
Semantic HTML
Lumidot uses semantic inline elements:- Container:
<span>(inline element) - Dots:
<span>(inline elements)
- Proper document flow
- No layout disruption
- Screen reader compatibility
Color Contrast
Lumidot colors are vibrant but may need contrast considerations:Dark Backgrounds
Most variants work well on dark backgrounds:Light Backgrounds
Use darker variants or increase glow for visibility:Best Practices
Use appropriate patterns
Choose less intense patterns for sequence animations if many users have reduced motion enabled:
Test with accessibility tools
- Enable
prefers-reduced-motionin your OS - Test with screen readers (NVDA, JAWS, VoiceOver)
- Verify color contrast in your specific context
Summary
Reduced Motion
- Automatic detection via
useReducedMotionhook - Shows all frames simultaneously in sequence mode
- Wave mode continues normally
- Real-time system preference updates
ARIA Support
role="status"for screen readersaria-label="Loading"announcement- Semantic HTML structure
- Test ID support
Data Attributes
data-lumidot-patterndata-lumidot-variantdata-lumidot-modedata-lumidot-dot-active
Best Practices
- Test with reduced motion enabled
- Verify color contrast
- Provide loading context
- Use appropriate patterns