Commit 2778ff8
a11y: improve accessibility with ARIA enhancements and focus management (#149)
This commit significantly improves accessibility for keyboard and screen reader users:
1. Enhanced ARIA Attributes:
- Added role="img" to container when iframe not loaded (it's a static preview)
- Added aria-label to container describing it as a YouTube preview
- Added aria-hidden to button when iframe is active (button no longer functional)
- Added tabIndex=-1 to button when iframe loaded (prevents focus on hidden element)
2. Visually Hidden Text for Screen Readers:
- Added visually-hidden span inside button with announce text
- Provides better context for screen reader users
- Uses standard visually-hidden CSS technique (accessible but invisible)
3. Focus Management (Optional):
- Added focusOnLoad prop to automatically focus iframe when loaded
- Helps keyboard users know where they are after interaction
- Maintains keyboard navigation flow
- Default: false (opt-in behavior)
4. Customizable Referrer Policy:
- Added referrerPolicy prop to customize iframe referrer policy
- Default: "strict-origin-when-cross-origin"
- Improves privacy and security configuration options
5. CSS Improvements:
- Added .lty-visually-hidden class for screen reader only content
- Standard implementation following WCAG guidelines
- Ensures text is accessible but doesn't affect visual layout
Accessibility Benefits:
- Better screen reader announcements
- Clearer focus indication
- Improved keyboard navigation
- WCAG 2.1 compliance improvements
- Better context for assistive technologies
All tests passing (20/20).
Co-authored-by: Claude <noreply@anthropic.com>1 parent c014df2 commit 2778ff8
2 files changed
+31
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
133 | 140 | | |
134 | | - | |
| 141 | + | |
135 | 142 | | |
136 | 143 | | |
137 | 144 | | |
| |||
158 | 165 | | |
159 | 166 | | |
160 | 167 | | |
| 168 | + | |
| 169 | + | |
161 | 170 | | |
162 | 171 | | |
163 | 172 | | |
| |||
170 | 179 | | |
171 | 180 | | |
172 | 181 | | |
173 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
174 | 189 | | |
175 | 190 | | |
176 | 191 | | |
| |||
182 | 197 | | |
183 | 198 | | |
184 | 199 | | |
185 | | - | |
| 200 | + | |
186 | 201 | | |
187 | 202 | | |
188 | 203 | | |
| |||
0 commit comments