Skip to content

Commit 74c76e7

Browse files
committed
fix(a11y): update default configuration and remove live monitoring options
1 parent a319478 commit 74c76e7

4 files changed

Lines changed: 4 additions & 96 deletions

File tree

docs/plugins/a11y.md

Lines changed: 4 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ The TanStack Devtools Accessibility (A11y) Plugin provides real-time accessibili
99

1010
- **Full Page Scanning** - Audit your entire page for accessibility violations
1111
- **Component-Level Scanning** - Scope audits to specific components using React hooks
12-
- **Live Monitoring** - Automatically re-scan when the DOM changes
1312
- **Visual Overlays** - Highlight problematic elements with severity-based colors
1413
- **Click-to-Navigate** - Click on an issue to automatically scroll to and highlight the element
1514
- **Dark Mode Support** - Automatically adapts to the devtools theme
@@ -87,25 +86,21 @@ Initial configuration can be provided via the vanilla plugin API:
8786
import { createA11yPlugin } from '@tanstack/devtools-a11y'
8887

8988
const plugin = createA11yPlugin({
89+
threshold: 'serious',
9090
ruleSet: 'wcag21aa',
91-
threshold: 'moderate',
92-
runOnMount: true,
93-
liveMonitoring: true,
94-
liveMonitoringDelay: 1000,
9591
showOverlays: true,
92+
persistSettings: true,
93+
disabledRules: [],
9694
})
9795
```
9896

9997
Common `options` fields:
10098

10199
- `threshold`: minimum impact level to show
102100
- `ruleSet`: rule preset (`'wcag2a' | 'wcag2aa' | 'wcag21aa' | 'wcag22aa' | 'section508' | 'best-practice' | 'all'`)
103-
- `disabledRules`: rule IDs to ignore
104101
- `showOverlays`: highlight issues in the page
105-
- `runOnMount`: auto-scan when panel mounts
106102
- `persistSettings`: store config in localStorage
107-
- `liveMonitoring`: watch DOM mutations and re-scan automatically
108-
- `liveMonitoringDelay`: debounce delay (ms)
103+
- `disabledRules`: rule IDs to ignore
109104

110105
If you don't need to provide initial configuration, you can use the framework plugin helpers
111106
directly (the settings UI persists changes to localStorage by default).
@@ -126,36 +121,6 @@ Issues are categorized by impact level with corresponding overlay colors:
126121
The panel UI is implemented in Solid and wrapped for React, Solid, Preact, and Vue
127122
using `@tanstack/devtools-utils`.
128123

129-
## Vanilla JavaScript API
130-
131-
For non-React applications, `createA11yPlugin()` exposes a small programmatic API in addition to the TanStack Devtools `render()` integration:
132-
133-
```ts
134-
import { createA11yPlugin } from '@tanstack/devtools-a11y'
135-
136-
const plugin = createA11yPlugin({
137-
ruleSet: 'wcag21aa',
138-
liveMonitoring: true,
139-
showOverlays: true,
140-
})
141-
142-
// Run a scan
143-
const result = await plugin.scan?.()
144-
145-
// Subscribe to scan results (manual or live)
146-
const unsubscribe = plugin.onScan?.((next) => {
147-
console.log('Issues found:', next.issues.length)
148-
})
149-
150-
// Control live monitoring
151-
plugin.startLiveMonitoring?.()
152-
plugin.stopLiveMonitoring?.()
153-
154-
// Clean up
155-
unsubscribe?.()
156-
plugin.destroy?.()
157-
```
158-
159124
## Export Formats
160125

161126
### JSON Export
@@ -184,52 +149,6 @@ The plugin supports the following accessibility standards:
184149
- **Section 508**
185150
- **Best Practices** (non-standard recommendations)
186151

187-
## Types
188-
189-
```ts
190-
interface A11yIssue {
191-
id: string
192-
ruleId: string
193-
impact: 'critical' | 'serious' | 'moderate' | 'minor'
194-
description: string
195-
help: string
196-
helpUrl: string
197-
selector: string
198-
html: string
199-
failureSummary: string
200-
tags: string[]
201-
}
202-
203-
interface A11yAuditResult {
204-
timestamp: number
205-
url: string
206-
standard: string
207-
issues: A11yIssue[]
208-
passes: number
209-
violations: number
210-
incomplete: number
211-
scanDuration: number
212-
}
213-
214-
interface A11yConfig {
215-
standard: string
216-
liveMonitoring: boolean
217-
showOverlays: boolean
218-
scopedMode: boolean
219-
scopeSelector?: string
220-
excludeSelectors: string[]
221-
includeRules: string[]
222-
excludeRules: string[]
223-
}
224-
```
225-
226-
## Performance Considerations
227-
228-
- **Live monitoring** uses a debounced MutationObserver to avoid excessive re-scanning
229-
- **Scoped scanning** is recommended for large pages to reduce scan time
230-
- **Exclude selectors** can skip third-party widgets or known-good sections
231-
- The first scan may be slower as axe-core initializes
232-
233152
## Troubleshooting
234153

235154
### Issues not appearing
@@ -244,12 +163,6 @@ interface A11yConfig {
244163
2. Check for CSS conflicts with `z-index` or `pointer-events`
245164
3. Ensure the container element exists in the DOM
246165

247-
### Performance issues
248-
249-
1. Disable live monitoring for large/complex pages
250-
2. Use scoped scanning to limit the audit area
251-
3. Increase the debounce delay for live monitoring
252-
253166
## Example
254167

255168
See the full working example at:

packages/devtools-a11y/src/core/types/types.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ export interface A11yPluginOptions {
144144
/** Minimum severity threshold (default: 'serious') */
145145
threshold?: SeverityThreshold
146146

147-
/** Run audit automatically on mount (default: false) */
148-
runOnMount?: boolean
149-
150147
/** Rule set preset (default: 'wcag21aa') */
151148
ruleSet?: RuleSetPreset
152149

packages/devtools-a11y/src/core/utils/config.utils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const STORAGE_KEY = 'tanstack-devtools-a11y-config'
77
*/
88
export const DEFAULT_CONFIG: Required<A11yPluginOptions> = {
99
threshold: 'serious',
10-
runOnMount: false,
1110
ruleSet: 'wcag21aa',
1211
showOverlays: true,
1312
persistSettings: true,

packages/devtools-a11y/tests/config.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ describe('config', () => {
3636
describe('DEFAULT_CONFIG', () => {
3737
it('should have expected default values', () => {
3838
expect(DEFAULT_CONFIG.threshold).toBe('serious')
39-
expect(DEFAULT_CONFIG.runOnMount).toBe(false)
4039
expect(DEFAULT_CONFIG.ruleSet).toBe('wcag21aa')
4140
expect(DEFAULT_CONFIG.showOverlays).toBe(true)
4241
expect(DEFAULT_CONFIG.persistSettings).toBe(true)

0 commit comments

Comments
 (0)