# screen-reader-reader

> Node.js helper for getting screen reader output

Latest version **0.1.2** (published 2019-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install screen-reader-reader
pnpm add screen-reader-reader
yarn add screen-reader-reader
bun add screen-reader-reader
```

Provides the command `screen-reader-reader`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2019-11-07 |
| First published | 2019-10-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 897.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 62 |
| Author | Craig Spence |
| Maintainers | phenomnomnominal |

## Links

- npm: https://www.npmjs.com/package/screen-reader-reader
- Repository: https://github.com/phenomnomnominal/screen-reader-reader
- Homepage: https://github.com/phenomnomnominal/screen-reader-reader#readme
- Issues: https://github.com/phenomnomnominal/screen-reader-reader/issues
- npm.io page: https://npm.io/package/screen-reader-reader

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^1.10.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0

## Recent versions

- 0.1.2 (latest) — 2019-11-07
- 0.1.1 — 2019-10-29
- 0.1.0 — 2019-10-28

## README

# screen-reader-reader

[![npm version](https://img.shields.io/npm/v/screen-reader-reader.svg)](https://img.shields.io/npm/v/screen-reader-reader.svg)

This is a very experimental attempt at creating a general purpose screen reader reader, with the aim of enabling more realistic end-to-end accessibility tests!

The goal would be to have something like this:

```ts
describe('my website', () => {
  it(`should have correct screen reader output`, async () => {
    await page.goto('https://www.my-website.com');

    const result = await startScreenReader({
      waitForStable: true
    });

    expect(result).toMatchSnapshot();
  });
});
```

This is _very_ much a work in progress! I would love your help to make this more stable!

## Currently working

- Turning on VoiceOver (Mac OS), reading VoiceOver output as text, turning off VoiceOver.
- Turning on [NVDA](https://www.nvaccess.org/) (Windows), reading NVDA output as text, turning off NVDA.

## Goals

- More stability. There is some unexpected behaviour when running the tests with Puppeteer that I'm sure people with more screen reader experience will be able to explain.
- More screen readers. It would be good to get this working with [JAWS](https://www.freedomscientific.com/products/software/jaws/) and other commonly used screen readers.
- Other things?

## Installation

```sh
npm install screen-reader-reader --save-dev
```

## Usage

### CLI

There is a very basic CLI. It will enable the given screen reader (or automatically detect one), and read the screen reader output until it is stable.

```sh
npx screen-reader-reader
```

### JavaScript

#### Import

```js
import { startScreenReader } from 'screen-reader-reader';
```

When using the API from JavaScript, there are two distinct modes:

#### Stable mode

```js
const result = await startScreenReader({
  waitForStable: true
});

console.log(result);
```

#### Manual mode

```js
const stop = await startScreenReader();

// Do whatever you want to do...

const result = await stop();
```

#### Options

The `startScreenReader` function takes a number of options:

```ts
type Options = {
  screenreader: ScreenReaderName; // Default = from local environment
  pollTimeout: number; // Default = 100ms
  stableTimeout: number; // Default = 10000ms
  waitForStable: boolean; // Default = false
  filters: Array<RegExp>; // Default = []
  mappers: Array<(t: string) => string>; // Default = []
};

const enum ScreenReaderName {
  voiceover,
  nvda
}
```

---
_Source: https://npm.io/package/screen-reader-reader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
