Skip to content

Commit

Permalink
revise intersting/uninteresting classification for AXNodes
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbay committed Aug 11, 2020
1 parent 8e29b7a commit 878f57e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/common/Accessibility.ts
Expand Up @@ -96,15 +96,16 @@ export interface SerializedAXNode {
*/
export interface SnapshotOptions {
/**
* Prune unintersting nodes from the tree.
* Prune uninteresting nodes from the tree.
* @defaultValue true
*/
interestingOnly?: boolean;
/**
* Prune unintersting nodes from the tree.
* Root node to get the accessibility tree for
* @defaultValue The root node of the entire page.
*/
root?: ElementHandle;
includeBackendDOMNodeId?: boolean;
}

/**
Expand Down Expand Up @@ -244,12 +245,14 @@ class AXNode {
private _hidden = false;
private _name: string;
private _role: string;
private _ignored: boolean;
private _cachedHasFocusableChild?: boolean;

constructor(payload: Protocol.Accessibility.AXNode) {
this.payload = payload;
this._name = this.payload.name ? this.payload.name.value : '';
this._role = this.payload.role ? this.payload.role.value : 'Unknown';
this._ignored = this.payload.ignored;

for (const property of this.payload.properties || []) {
if (property.name === 'editable') {
Expand All @@ -264,11 +267,7 @@ class AXNode {
private _isPlainTextField(): boolean {
if (this._richlyEditable) return false;
if (this._editable) return true;
return (
this._role === 'textbox' ||
this._role === 'ComboBox' ||
this._role === 'searchbox'
);
return this._role === 'textbox' || this._role === 'searchbox';
}

private _isTextOnlyObject(): boolean {
Expand Down Expand Up @@ -354,6 +353,7 @@ class AXNode {
case 'tab':
case 'textbox':
case 'tree':
case 'treeitem':
return true;
default:
return false;
Expand All @@ -363,6 +363,7 @@ class AXNode {
public isInteresting(insideControl: boolean): boolean {
const role = this._role;
if (role === 'Ignored' || this._hidden) return false;
if (this._ignored) return false;

if (this._focusable || this._richlyEditable) return true;

Expand Down

0 comments on commit 878f57e

Please sign in to comment.