mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: revise interesting classification for AXNodes (#6334)
This commit is contained in:
parent
13ea347c7d
commit
7b24e5435b
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SnapshotOptions.interestingOnly property
|
## SnapshotOptions.interestingOnly property
|
||||||
|
|
||||||
Prune unintersting nodes from the tree.
|
Prune uninteresting nodes from the tree.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -15,6 +15,6 @@ export interface SnapshotOptions
|
|||||||
|
|
||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| [interestingOnly](./puppeteer.snapshotoptions.interestingonly.md) | boolean | Prune unintersting nodes from the tree. |
|
| [interestingOnly](./puppeteer.snapshotoptions.interestingonly.md) | boolean | Prune uninteresting nodes from the tree. |
|
||||||
| [root](./puppeteer.snapshotoptions.root.md) | [ElementHandle](./puppeteer.elementhandle.md) | Prune unintersting nodes from the tree. |
|
| [root](./puppeteer.snapshotoptions.root.md) | [ElementHandle](./puppeteer.elementhandle.md) | Root node to get the accessibility tree for |
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SnapshotOptions.root property
|
## SnapshotOptions.root property
|
||||||
|
|
||||||
Prune unintersting nodes from the tree.
|
Root node to get the accessibility tree for
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -96,12 +96,12 @@ export interface SerializedAXNode {
|
|||||||
*/
|
*/
|
||||||
export interface SnapshotOptions {
|
export interface SnapshotOptions {
|
||||||
/**
|
/**
|
||||||
* Prune unintersting nodes from the tree.
|
* Prune uninteresting nodes from the tree.
|
||||||
* @defaultValue true
|
* @defaultValue true
|
||||||
*/
|
*/
|
||||||
interestingOnly?: boolean;
|
interestingOnly?: boolean;
|
||||||
/**
|
/**
|
||||||
* Prune unintersting nodes from the tree.
|
* Root node to get the accessibility tree for
|
||||||
* @defaultValue The root node of the entire page.
|
* @defaultValue The root node of the entire page.
|
||||||
*/
|
*/
|
||||||
root?: ElementHandle;
|
root?: ElementHandle;
|
||||||
@ -244,12 +244,14 @@ class AXNode {
|
|||||||
private _hidden = false;
|
private _hidden = false;
|
||||||
private _name: string;
|
private _name: string;
|
||||||
private _role: string;
|
private _role: string;
|
||||||
|
private _ignored: boolean;
|
||||||
private _cachedHasFocusableChild?: boolean;
|
private _cachedHasFocusableChild?: boolean;
|
||||||
|
|
||||||
constructor(payload: Protocol.Accessibility.AXNode) {
|
constructor(payload: Protocol.Accessibility.AXNode) {
|
||||||
this.payload = payload;
|
this.payload = payload;
|
||||||
this._name = this.payload.name ? this.payload.name.value : '';
|
this._name = this.payload.name ? this.payload.name.value : '';
|
||||||
this._role = this.payload.role ? this.payload.role.value : 'Unknown';
|
this._role = this.payload.role ? this.payload.role.value : 'Unknown';
|
||||||
|
this._ignored = this.payload.ignored;
|
||||||
|
|
||||||
for (const property of this.payload.properties || []) {
|
for (const property of this.payload.properties || []) {
|
||||||
if (property.name === 'editable') {
|
if (property.name === 'editable') {
|
||||||
@ -264,11 +266,7 @@ class AXNode {
|
|||||||
private _isPlainTextField(): boolean {
|
private _isPlainTextField(): boolean {
|
||||||
if (this._richlyEditable) return false;
|
if (this._richlyEditable) return false;
|
||||||
if (this._editable) return true;
|
if (this._editable) return true;
|
||||||
return (
|
return this._role === 'textbox' || this._role === 'searchbox';
|
||||||
this._role === 'textbox' ||
|
|
||||||
this._role === 'ComboBox' ||
|
|
||||||
this._role === 'searchbox'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _isTextOnlyObject(): boolean {
|
private _isTextOnlyObject(): boolean {
|
||||||
@ -354,6 +352,7 @@ class AXNode {
|
|||||||
case 'tab':
|
case 'tab':
|
||||||
case 'textbox':
|
case 'textbox':
|
||||||
case 'tree':
|
case 'tree':
|
||||||
|
case 'treeitem':
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -362,7 +361,7 @@ class AXNode {
|
|||||||
|
|
||||||
public isInteresting(insideControl: boolean): boolean {
|
public isInteresting(insideControl: boolean): boolean {
|
||||||
const role = this._role;
|
const role = this._role;
|
||||||
if (role === 'Ignored' || this._hidden) return false;
|
if (role === 'Ignored' || this._hidden || this._ignored) return false;
|
||||||
|
|
||||||
if (this._focusable || this._richlyEditable) return true;
|
if (this._focusable || this._richlyEditable) return true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user