@reticular/speakable 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Speakable
2
2
 
3
- Simulate how NVDA, JAWS, VoiceOver, and Windows Narrator interpret your HTML — from a single CLI tool. Catch screen reader issues early, detect regressions in CI/CD, and reduce manual testing overhead.
3
+ Predict how NVDA, JAWS, VoiceOver, and Windows Narrator interpret your HTML, and detect accessibility behavior regressions during component interaction. Catch screen reader issues early, analyze runtime focus management, and prevent regressions in CI/CD.
4
4
 
5
- **Try it in your browser — no install needed:** [getspeakable.dev/tool](https://getspeakable.dev/tool)
5
+ **Try it in your browser:** [getspeakable.dev/tool](https://getspeakable.dev/tool)
6
6
 
7
- Speakable bridges the gap between rule-based linting tools (like axe) and manual screen reader testing. It gives you scalable, automated insight into how assistive technologies will interpret your UI.
7
+ Speakable bridges the gap between rule-based linting tools (like axe) and manual screen reader testing. It provides both static HTML analysis and runtime accessibility behavior tracking, giving you automated insight into how assistive technologies interpret your UI throughout the development lifecycle.
8
8
 
9
9
  > Screen reader output is heuristic and may differ from actual behavior. Speakable complements manual testing — it doesn't replace it.
10
10
 
@@ -160,6 +160,123 @@ Verify that the accessibility model serializes and deserializes consistently:
160
160
  speakable page.html --validate
161
161
  ```
162
162
 
163
+ ## Runtime Accessibility Analysis
164
+
165
+ Beyond static HTML analysis, Speakable tracks accessibility behavior during component interaction: focus transitions, ARIA state changes, live region announcements, and dialog lifecycle events.
166
+
167
+ ### CLI Usage
168
+
169
+ ```bash
170
+ # Analyze runtime behavior of a URL
171
+ speakable runtime https://localhost:3000/settings
172
+
173
+ # Use a built-in interaction pattern
174
+ speakable runtime https://localhost:3000 --interaction modal-dialog
175
+
176
+ # Analyze all Storybook stories
177
+ speakable runtime http://localhost:6006 --storybook
178
+
179
+ # Filter to specific components
180
+ speakable runtime http://localhost:6006 --storybook --story "Dialog*"
181
+
182
+ # Save baselines for regression detection
183
+ speakable runtime http://localhost:6006 --storybook --runtime-snapshot ./baselines
184
+
185
+ # CI mode: fail on behavior regressions
186
+ speakable runtime http://localhost:6006 --storybook --runtime-snapshot ./baselines --runtime-ci
187
+
188
+ # Authenticate with protected Storybook instances
189
+ speakable runtime https://storybook.internal.co --storybook \
190
+ --storybook-auth-header "Bearer your-token"
191
+ ```
192
+
193
+ ### Programmatic API
194
+
195
+ ```typescript
196
+ import { runtime } from '@reticular/speakable';
197
+
198
+ const generator = runtime.createTimelineGenerator({
199
+ document: myDocument,
200
+ componentName: 'SettingsDialog',
201
+ });
202
+
203
+ const sequence = runtime.getBuiltinPattern('modal-dialog', {
204
+ trigger: 'button.open-settings',
205
+ });
206
+
207
+ const timeline = await generator.capture(sequence);
208
+
209
+ // Inspect events
210
+ timeline.events.forEach(event => {
211
+ console.log(`${event.type}: ${event.target.accessibleName}`);
212
+ });
213
+
214
+ // Check for warnings (focus escape, missing announcements, etc.)
215
+ timeline.warnings.forEach(w => {
216
+ console.warn(w.payload.message);
217
+ });
218
+ ```
219
+
220
+ ### Built-in Interaction Patterns
221
+
222
+ | Pattern | What it tests |
223
+ |---------|---------------|
224
+ | `modal-dialog` | Focus moves to dialog, stays trapped, returns on close |
225
+ | `combobox` | Options announced on arrow navigation, selection confirmed |
226
+ | `tabs` | Arrow keys switch tabs, panel content communicated |
227
+ | `accordion` | Expanded/collapsed state announced on toggle |
228
+
229
+ ### Heuristic Warnings
230
+
231
+ The runtime engine automatically detects common anti-patterns without needing a baseline:
232
+
233
+ - Focus not moved into modal dialog on open
234
+ - Focus escaped modal dialog (broken focus trap)
235
+ - Rapid announcements (aria-live flooding)
236
+ - Keyboard action with no accessibility response
237
+ - Focused element removed without focus management
238
+
239
+ ### Behavior Diffing and Regression Detection
240
+
241
+ Compare accessibility timelines across builds to catch regressions:
242
+
243
+ ```typescript
244
+ import { runtime } from '@reticular/speakable';
245
+
246
+ const diff = runtime.diffTimelines(baselineTimeline, currentTimeline);
247
+ // diff.added, diff.removed, diff.modified
248
+
249
+ const classified = runtime.classifyDiff(diff);
250
+ // classified.highestSeverity: 'critical' | 'high' | 'medium' | 'low'
251
+ ```
252
+
253
+ Severity levels:
254
+ - **Critical**: Focus loss, modal focus escape, missing required announcements
255
+ - **High**: Incorrect focus restoration, keyboard navigation regression
256
+ - **Medium**: Additional announcements, accessible name changes
257
+ - **Low**: Timing differences, non-breaking behavior changes
258
+
259
+ ### Storybook Integration
260
+
261
+ Connect to a running Storybook instance to analyze accessibility behavior across your component library:
262
+
263
+ ```typescript
264
+ import { createStorybookAdapter, createStoryLoader } from '@reticular/speakable/storybook';
265
+
266
+ const adapter = createStorybookAdapter({
267
+ url: 'http://localhost:6006',
268
+ componentFilter: 'Dialog*',
269
+ authHeader: 'Bearer token', // for protected instances
270
+ });
271
+
272
+ await adapter.connect();
273
+ const stories = await adapter.discoverStories();
274
+ ```
275
+
276
+ The Storybook pipeline discovers stories, loads them in isolation, runs interaction patterns, and produces timelines that can be baselined and compared. Works with Storybook 7.x and 8.x.
277
+
278
+ > See the [Runtime Analysis docs](https://getspeakable.dev/docs/runtime-analysis) for interactive demos and full API reference.
279
+
163
280
  ## MCP Integration (AI Assistants)
164
281
 
165
282
  Speakable includes a Model Context Protocol (MCP) server that lets AI coding assistants analyze accessibility in real-time. Ask your assistant "check if this component is accessible" and it calls Speakable automatically.
@@ -186,6 +303,8 @@ Add to your MCP config (Kiro, VS Code, Cursor, Claude Desktop, Windsurf):
186
303
  | `analyze_html` | Predict screen reader output for NVDA, JAWS, VoiceOver, and Narrator |
187
304
  | `audit_html` | Generate accessibility audit report with issues and remediation |
188
305
  | `diff_html` | Compare two HTML versions for accessibility regressions |
306
+ | `analyze_runtime` | Run runtime accessibility analysis with interaction sequences |
307
+ | `diff_runtime` | Compare two accessibility timelines for behavior regressions |
189
308
 
190
309
  All tools run locally — no network requests, no data leaves your machine. See the [MCP Integration docs](https://getspeakable.dev/docs/mcp-integration) for full setup instructions.
191
310
 
@@ -270,10 +389,10 @@ Speakable processes HTML through a four-stage pipeline:
270
389
 
271
390
  - Replace manual screen reader testing with real assistive technology
272
391
  - Guarantee WCAG compliance
273
- - Test dynamic/JavaScript-driven content (it analyzes static HTML)
274
392
  - Perfectly replicate screen reader behavior (output is heuristic)
393
+ - Execute JavaScript in static analysis mode (use runtime mode for dynamic content)
275
394
 
276
- Use Speakable to catch issues early and reduce the manual testing burden — then validate critical flows with real screen readers.
395
+ Use Speakable to catch issues early and reduce the manual testing burden. Validate critical flows with real screen readers.
277
396
 
278
397
  ## Best Practices
279
398