docs: fixing example code in accessibility API docs (#12664)

Co-authored-by: Andrey Lushnikov <aslushnikov@gmail.com>
This commit is contained in:
Andrew Hayward 2022-03-23 10:50:35 +00:00 committed by GitHub
parent 04e9d2ec08
commit ab39cfcb18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -91,6 +91,7 @@ function findFocusedNode(node) {
return node; return node;
for (const child of node.children || []) { for (const child of node.children || []) {
const foundNode = findFocusedNode(child); const foundNode = findFocusedNode(child);
if (foundNode)
return foundNode; return foundNode;
} }
return null; return null;
@ -113,6 +114,7 @@ def find_focused_node(node):
return node return node
for child in (node.get("children") or []): for child in (node.get("children") or []):
found_node = find_focused_node(child) found_node = find_focused_node(child)
if (found_node)
return found_node return found_node
return None return None
@ -128,6 +130,7 @@ def find_focused_node(node):
return node return node
for child in (node.get("children") or []): for child in (node.get("children") or []):
found_node = find_focused_node(child) found_node = find_focused_node(child)
if (found_node)
return found_node return found_node
return None return None

View file

@ -10661,6 +10661,7 @@ export interface Accessibility {
* return node; * return node;
* for (const child of node.children || []) { * for (const child of node.children || []) {
* const foundNode = findFocusedNode(child); * const foundNode = findFocusedNode(child);
* if (foundNode)
* return foundNode; * return foundNode;
* } * }
* return null; * return null;