-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hybrid of a11y tree & DOM for input to observe #459
Conversation
🦋 Changeset detectedLatest commit: 5a7bd49 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, you're cooking here
lib/a11y/utils.ts
Outdated
parentId: node.parentId, | ||
childIds: node.childIds, | ||
xpath: node.xpath, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for large websites it makes sense to compute the xpaths at runtime for the candidates selected by observe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah nice catch, we arent precomputing them, i'll take them out of the AXNode type since they are unused
@@ -99,6 +107,10 @@ export function buildHierarchicalTree(nodes: AccessibilityNode[]): TreeResult { | |||
...(hasValidName && { name: node.name }), // Only include name if it exists and isn't empty | |||
...(node.description && { description: node.description }), | |||
...(node.value && { value: node.value }), | |||
...(node.backendDOMNodeId !== undefined && { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isnt backendDOMNodeId === nodeId?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, nodeId is a11y specific (remember we used to have negative values for nodeIds)
lib/a11y/utils.ts
Outdated
level: 1, | ||
}); | ||
|
||
// fs.writeFileSync("../hybrid_tree.txt", hierarchicalTree.simplified); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// fs.writeFileSync("../hybrid_tree.txt", hierarchicalTree.simplified); |
why
role
for anAXNode
is something useless likenone
orgeneric
. this isn't very helpful context for the LLMwhat changed
role
for anAXNode
isnone
orgeneric
, we replace it with thetagName
of its corresponding DOM elementbefore this PR:
after this PR: