Skip to content

Commit

Permalink
feat(new-docs): add TSDoc comments to Accessibility (#5971)
Browse files Browse the repository at this point in the history
* feat(new-docs): add tsdoc to `Accessibility`
  • Loading branch information
jackfranklin committed Jun 5, 2020
1 parent 086c089 commit 0b3d52a
Show file tree
Hide file tree
Showing 36 changed files with 590 additions and 34 deletions.
20 changes: 0 additions & 20 deletions new-docs/puppeteer.accessibility._constructor_.md

This file was deleted.

16 changes: 11 additions & 5 deletions new-docs/puppeteer.accessibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,27 @@

## Accessibility class

The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access)<!-- -->.

<b>Signature:</b>

```typescript
export declare class Accessibility
```

## Constructors
## Remarks

| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(client)](./puppeteer.accessibility._constructor_.md) | | Constructs a new instance of the <code>Accessibility</code> class |
Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might have wildly different output.

Blink - Chrome's rendering engine - has a concept of "accessibility tree", which is then translated into different platform-specific APIs. Accessibility namespace gives users access to the Blink Accessibility Tree.

Most of the accessibility tree gets filtered out when converting from Blink AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. By default, Puppeteer tries to approximate this filtering, exposing only the "interesting" nodes of the tree.

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `Accessibility` class.

## Methods

| Method | Modifiers | Description |
| --- | --- | --- |
| [snapshot(options)](./puppeteer.accessibility.snapshot.md) | | |
| [snapshot(options)](./puppeteer.accessibility.snapshot.md) | | Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page. |

48 changes: 42 additions & 6 deletions new-docs/puppeteer.accessibility.snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,58 @@

## Accessibility.snapshot() method

Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page.

<b>Signature:</b>

```typescript
snapshot(options?: {
interestingOnly?: boolean;
root?: ElementHandle;
}): Promise<SerializedAXNode>;
snapshot(options?: SnapshotOptions): Promise<SerializedAXNode>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| options | { interestingOnly?: boolean; root?: [ElementHandle](./puppeteer.elementhandle.md)<!-- -->; } | |
| options | [SnapshotOptions](./puppeteer.snapshotoptions.md) | |

<b>Returns:</b>

Promise&lt;SerializedAXNode&gt;
Promise&lt;[SerializedAXNode](./puppeteer.serializedaxnode.md)<!-- -->&gt;

An AXNode object represeting the snapshot.

## Remarks

\*\*NOTE\*\* The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. Puppeteer will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`<!-- -->.

## Example 1

An example of dumping the entire accessibility tree:

```js
const snapshot = await page.accessibility.snapshot();
console.log(snapshot);

```

## Example 2

An example of logging the focused node's name:

```js
const snapshot = await page.accessibility.snapshot();
const node = findFocusedNode(snapshot);
console.log(node && node.name);

function findFocusedNode(node) {
if (node.focused)
return node;
for (const child of node.children || []) {
const foundNode = findFocusedNode(child);
return foundNode;
}
return null;
}

```

4 changes: 3 additions & 1 deletion new-docs/puppeteer.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

| Class | Description |
| --- | --- |
| [Accessibility](./puppeteer.accessibility.md) | |
| [Accessibility](./puppeteer.accessibility.md) | The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access)<!-- -->. |
| [Browser](./puppeteer.browser.md) | |
| [BrowserContext](./puppeteer.browsercontext.md) | |
| [BrowserFetcher](./puppeteer.browserfetcher.md) | |
Expand Down Expand Up @@ -53,6 +53,8 @@
| Interface | Description |
| --- | --- |
| [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) | |
| [SerializedAXNode](./puppeteer.serializedaxnode.md) | Represents a Node and the properties of it that are relevant to Accessibility. |
| [SnapshotOptions](./puppeteer.snapshotoptions.md) | |

## Variables

Expand Down
11 changes: 11 additions & 0 deletions new-docs/puppeteer.serializedaxnode.autocomplete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [autocomplete](./puppeteer.serializedaxnode.autocomplete.md)

## SerializedAXNode.autocomplete property

<b>Signature:</b>

```typescript
autocomplete?: string;
```
13 changes: 13 additions & 0 deletions new-docs/puppeteer.serializedaxnode.checked.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [checked](./puppeteer.serializedaxnode.checked.md)

## SerializedAXNode.checked property

Whether the checkbox is checked, or in a [mixed state](https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-2/checkbox-2.html)<!-- -->.

<b>Signature:</b>

```typescript
checked?: boolean | 'mixed';
```
13 changes: 13 additions & 0 deletions new-docs/puppeteer.serializedaxnode.children.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [children](./puppeteer.serializedaxnode.children.md)

## SerializedAXNode.children property

Children of this node, if there are any.

<b>Signature:</b>

```typescript
children?: SerializedAXNode[];
```
13 changes: 13 additions & 0 deletions new-docs/puppeteer.serializedaxnode.description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [description](./puppeteer.serializedaxnode.description.md)

## SerializedAXNode.description property

An additional human readable description of the node.

<b>Signature:</b>

```typescript
description?: string;
```
11 changes: 11 additions & 0 deletions new-docs/puppeteer.serializedaxnode.disabled.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [disabled](./puppeteer.serializedaxnode.disabled.md)

## SerializedAXNode.disabled property

<b>Signature:</b>

```typescript
disabled?: boolean;
```
11 changes: 11 additions & 0 deletions new-docs/puppeteer.serializedaxnode.expanded.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [expanded](./puppeteer.serializedaxnode.expanded.md)

## SerializedAXNode.expanded property

<b>Signature:</b>

```typescript
expanded?: boolean;
```
11 changes: 11 additions & 0 deletions new-docs/puppeteer.serializedaxnode.focused.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [focused](./puppeteer.serializedaxnode.focused.md)

## SerializedAXNode.focused property

<b>Signature:</b>

```typescript
focused?: boolean;
```
11 changes: 11 additions & 0 deletions new-docs/puppeteer.serializedaxnode.haspopup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [haspopup](./puppeteer.serializedaxnode.haspopup.md)

## SerializedAXNode.haspopup property

<b>Signature:</b>

```typescript
haspopup?: string;
```
13 changes: 13 additions & 0 deletions new-docs/puppeteer.serializedaxnode.invalid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [invalid](./puppeteer.serializedaxnode.invalid.md)

## SerializedAXNode.invalid property

Whether and in what way this node's value is invalid.

<b>Signature:</b>

```typescript
invalid?: string;
```
13 changes: 13 additions & 0 deletions new-docs/puppeteer.serializedaxnode.keyshortcuts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [keyshortcuts](./puppeteer.serializedaxnode.keyshortcuts.md)

## SerializedAXNode.keyshortcuts property

Any keyboard shortcuts associated with this node.

<b>Signature:</b>

```typescript
keyshortcuts?: string;
```
13 changes: 13 additions & 0 deletions new-docs/puppeteer.serializedaxnode.level.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [level](./puppeteer.serializedaxnode.level.md)

## SerializedAXNode.level property

The level of a heading.

<b>Signature:</b>

```typescript
level?: number;
```
45 changes: 45 additions & 0 deletions new-docs/puppeteer.serializedaxnode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md)

## SerializedAXNode interface

Represents a Node and the properties of it that are relevant to Accessibility.

<b>Signature:</b>

```typescript
export interface SerializedAXNode
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [autocomplete](./puppeteer.serializedaxnode.autocomplete.md) | string | |
| [checked](./puppeteer.serializedaxnode.checked.md) | boolean \| 'mixed' | Whether the checkbox is checked, or in a [mixed state](https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-2/checkbox-2.html)<!-- -->. |
| [children](./puppeteer.serializedaxnode.children.md) | [SerializedAXNode](./puppeteer.serializedaxnode.md)<!-- -->\[\] | Children of this node, if there are any. |
| [description](./puppeteer.serializedaxnode.description.md) | string | An additional human readable description of the node. |
| [disabled](./puppeteer.serializedaxnode.disabled.md) | boolean | |
| [expanded](./puppeteer.serializedaxnode.expanded.md) | boolean | |
| [focused](./puppeteer.serializedaxnode.focused.md) | boolean | |
| [haspopup](./puppeteer.serializedaxnode.haspopup.md) | string | |
| [invalid](./puppeteer.serializedaxnode.invalid.md) | string | Whether and in what way this node's value is invalid. |
| [keyshortcuts](./puppeteer.serializedaxnode.keyshortcuts.md) | string | Any keyboard shortcuts associated with this node. |
| [level](./puppeteer.serializedaxnode.level.md) | number | The level of a heading. |
| [modal](./puppeteer.serializedaxnode.modal.md) | boolean | |
| [multiline](./puppeteer.serializedaxnode.multiline.md) | boolean | |
| [multiselectable](./puppeteer.serializedaxnode.multiselectable.md) | boolean | Whether more than one child can be selected. |
| [name](./puppeteer.serializedaxnode.name.md) | string | A human readable name for the node. |
| [orientation](./puppeteer.serializedaxnode.orientation.md) | string | |
| [pressed](./puppeteer.serializedaxnode.pressed.md) | boolean \| 'mixed' | Whether the node is checked or in a mixed state. |
| [readonly](./puppeteer.serializedaxnode.readonly.md) | boolean | |
| [required](./puppeteer.serializedaxnode.required.md) | boolean | |
| [role](./puppeteer.serializedaxnode.role.md) | string | The [role](https://www.w3.org/TR/wai-aria/#usage_intro) of the node. |
| [roledescription](./puppeteer.serializedaxnode.roledescription.md) | string | A human readable alternative to the role. |
| [selected](./puppeteer.serializedaxnode.selected.md) | boolean | |
| [value](./puppeteer.serializedaxnode.value.md) | string \| number | The current value of the node. |
| [valuemax](./puppeteer.serializedaxnode.valuemax.md) | number | |
| [valuemin](./puppeteer.serializedaxnode.valuemin.md) | number | |
| [valuetext](./puppeteer.serializedaxnode.valuetext.md) | string | A description of the current value. |

11 changes: 11 additions & 0 deletions new-docs/puppeteer.serializedaxnode.modal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [modal](./puppeteer.serializedaxnode.modal.md)

## SerializedAXNode.modal property

<b>Signature:</b>

```typescript
modal?: boolean;
```
11 changes: 11 additions & 0 deletions new-docs/puppeteer.serializedaxnode.multiline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [multiline](./puppeteer.serializedaxnode.multiline.md)

## SerializedAXNode.multiline property

<b>Signature:</b>

```typescript
multiline?: boolean;
```
13 changes: 13 additions & 0 deletions new-docs/puppeteer.serializedaxnode.multiselectable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [multiselectable](./puppeteer.serializedaxnode.multiselectable.md)

## SerializedAXNode.multiselectable property

Whether more than one child can be selected.

<b>Signature:</b>

```typescript
multiselectable?: boolean;
```
13 changes: 13 additions & 0 deletions new-docs/puppeteer.serializedaxnode.name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [name](./puppeteer.serializedaxnode.name.md)

## SerializedAXNode.name property

A human readable name for the node.

<b>Signature:</b>

```typescript
name?: string;
```
11 changes: 11 additions & 0 deletions new-docs/puppeteer.serializedaxnode.orientation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [SerializedAXNode](./puppeteer.serializedaxnode.md) &gt; [orientation](./puppeteer.serializedaxnode.orientation.md)

## SerializedAXNode.orientation property

<b>Signature:</b>

```typescript
orientation?: string;
```

0 comments on commit 0b3d52a

Please sign in to comment.