Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update deps and docs
  • Loading branch information
tombrunet committed Mar 26, 2026
commit 57609d41c49bad13713626977520159032f62ec1
753 changes: 387 additions & 366 deletions accessibility-checker-extension/package-lock.json

Large diffs are not rendered by default.

283 changes: 152 additions & 131 deletions accessibility-checker-extension/test/package-lock.json

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions accessibility-checker/boilerplates/jest-puppeteer-ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,35 @@ Key features include:
- TypeScript for improved code quality and developer experience
- Custom [Jest](https://www.npmjs.com/package/jest) matchers for more readable test assertions
- Configuration options for tailoring accessibility testing to your needs
- **Screen reader simulation testing** - Uses the experimental `getSimulation` API to verify screen reader output

## Screen Reader Simulation (Experimental)

> **⚠️ EXPERIMENTAL FEATURE**: The `getSimulation` API is experimental and subject to change. The output format and behavior may be modified in future releases.

This boilerplate demonstrates how to use the `getSimulation` method to test screen reader output. The method generates a simulation of how a screen reader would announce page elements, including:

- ARIA regions and landmarks
- Heading levels and text
- Interactive elements (links, buttons, form fields)
- Image alternative text
- Keyboard focus announcements

Example usage from `test-ts/basic.test.ts`:

```typescript
import { getSimulation } from "accessibility-checker";

test('SR simulation has not regressed', async() => {
const simulation = await getSimulation(page, 'test_name');
expect(simulation).toEqual([
{ "region": "", "heading": "", "item": "[Start of document: ...]", ... },
// ... more simulation output
]);
})
```

This allows you to create regression tests that ensure the screen reader experience remains consistent across code changes.

## Learn More

Expand Down
23 changes: 23 additions & 0 deletions accessibility-checker/src-ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,29 @@ export function getCompliance(content: any,
}
}

/**
* EXPERIMENTAL: This function generates a screen reader simulation of the provided content.
* The simulation represents how a screen reader would announce page elements, including
* regions, headings, interactive elements, and images.
*
* WARNING: This API is experimental and subject to change. The output format and behavior
* may be modified in future releases.
*
* Supported context types:
* Single node (HTMLElement)
* Local file path (String)
* URL (String)
* document node
* data stream for html content (String)
* Puppeteer Page
* Playwright Page
* Selenium WebDriver
*
* @param {(String|HTMLElement|DocumentNode|Puppeteer Page|Playwright Page|Selenium WebDriver)} content - Provide the context to simulate
* @param {String} label - Provide a label for the simulation that is being performed
* @param {Function} callback - (optional) Provide callback function which will be executed once the simulation is generated.
* @return Promise with the ISimulatorStructure containing an array of screen reader announcements
*/
export function getSimulation(content: any, label: string, callback?: (report: ISimulatorStructure) => void) : Promise<ISimulatorStructure>
{
if (callback) {
Expand Down
23 changes: 23 additions & 0 deletions accessibility-checker/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,29 @@ Returns `String` representation of the scan results which can be logged to the c

Retrieve the configuration object used by accessibility-checker. See aceconfig.js / .achecker.yml above for details

### async aChecker.getSimulation(`content`, `label` : string) - **EXPERIMENTAL**

> **⚠️ EXPERIMENTAL FEATURE**: This API is experimental and subject to change. The output format and behavior may be modified in future releases.

Generate a screen reader simulation of the page content. This provides a representation of how a screen reader would announce the page elements, including regions, headings, interactive elements, and images.

- `content` - Same types as `getCompliance`: HTML content (String), Single node/widget (HTMLElement), Local file path (String), URL (String), Document node (HTMLDocument), [Selenium WebDriver](https://www.npmjs.com/package/selenium-webdriver) (WebDriver), [Puppeteer](https://www.npmjs.com/package/puppeteer) page, or [Playwright](https://www.npmjs.com/package/playwright) page
- `label` - (String) unique label to identify this simulation

Returns a promise with an array of objects representing the screen reader output. Each object contains:
- `region` - ARIA region announcements
- `heading` - Heading level and text
- `item` - The main announcement text
- `tab_focus` - Text announced when element receives keyboard focus
- `image` - Image alternative text announcements
- `selector` - CSS selector for the element

Example usage:
```javascript
const simulation = await aChecker.getSimulation(page, 'my-page-label');
// Returns array of screen reader announcements
```

### async aChecker.close()

Close [Puppeteer](https://www.npmjs.com/package/puppeteer) pages and other resources that may be used by accessibility-checker.
Expand Down
115 changes: 59 additions & 56 deletions common/module/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions cypress-accessibility-checker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ Examples of how to use each of the APIs below can be found in the `achecker.js`
- `cy.diffResultsWithExpected(actual, expected, clean)`
- `cy.stringifyResults(report)`
- `cy.getACheckerConfig()`
- `cy.getSimulation(label)` - **EXPERIMENTAL**
- > **⚠️ EXPERIMENTAL FEATURE**: This API is experimental and subject to change. The output format and behavior may be modified in future releases.
- Generate a screen reader simulation of the current page. Returns an array of objects representing how a screen reader would announce page elements, including regions, headings, interactive elements, and images.

Chain the commands similar to other [Cypress](https://www.npmjs.com/package/cypress) commands. For example, `cy.getCompliance('my-label').assertCompliance()` will get the compliance report of the document and then assert there are no violations or that it matches up with a baseline of the same label.

Expand Down
Loading
Loading