fix: add InlineTextBox as a non-element a11y role (#11142)

This commit is contained in:
Alex Rudenko 2023-10-13 09:20:19 +02:00 committed by GitHub
parent b020e77991
commit 8aa6cb37d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,8 @@ import type {AwaitableIterable} from '../common/types.js';
import {assert} from '../util/assert.js';
import {AsyncIterableUtil} from '../util/AsyncIterableUtil.js';
const NON_ELEMENT_NODE_ROLES = new Set(['StaticText', 'InlineTextBox']);
const queryAXTree = async (
client: CDPSession,
element: ElementHandle<Node>,
@ -35,7 +37,7 @@ const queryAXTree = async (
role,
});
return nodes.filter((node: Protocol.Accessibility.AXNode) => {
return !node.role || node.role.value !== 'StaticText';
return !node.role || !NON_ELEMENT_NODE_ROLES.has(node.role.value);
});
};