Skip to content
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

feat: allow creating ElementHandles from the accessibility tree snapshot #12233

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

OrKoN
Copy link
Collaborator

@OrKoN OrKoN commented Apr 7, 2024

Closes #3641

@OrKoN OrKoN force-pushed the main branch 4 times, most recently from 2ff1e4f to e0932e5 Compare April 16, 2024 09:37
@OrKoN OrKoN changed the title chore: a11y handle feat: allow creating Element handles from the accessibility tree snapshot Jun 11, 2024
@OrKoN OrKoN changed the title feat: allow creating Element handles from the accessibility tree snapshot feat: allow creating ElementHandles from the accessibility tree snapshot Jun 11, 2024
@OrKoN OrKoN marked this pull request as ready for review June 11, 2024 17:18
Comment on lines +451 to +458
elementHandle: async (): Promise<ElementHandle | null> => {
if (!this.payload.backendDOMNodeId) {
return null;
}
return (await this.#realm.adoptBackendNode(
this.payload.backendDOMNodeId
)) as ElementHandle<Element>;
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about something like this, so we change the struct less?
And you are can just check 'elementHandle' in X

Suggested change
elementHandle: async (): Promise<ElementHandle | null> => {
if (!this.payload.backendDOMNodeId) {
return null;
}
return (await this.#realm.adoptBackendNode(
this.payload.backendDOMNodeId
)) as ElementHandle<Element>;
},
...{ this.payload.backendDOMNodeId ? {
elementHandle: async (): Promise<ElementHandle> => {
return (await this.#realm.adoptBackendNode(
this.payload.backendDOMNodeId
)) as ElementHandle<Element>;}
}
: {}
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accessibility: expose element reference
2 participants