update accessibility hierarchy to treat lithoViews and LithoRecyclerViews as ViewGroups

Summary: This will correctly show all view children instead of reverting to the non-ax default behavior. Fixes bug where recycler views showed no children.

Reviewed By: jknoxville

Differential Revision: D18574220

fbshipit-source-id: f22606fb582e0bfd1a171dc4497e1d1613e800d1
This commit is contained in:
Sara Valderrama
2019-11-19 10:01:49 -08:00
committed by Facebook Github Bot
parent 19df98e525
commit 353cfeafc8
2 changed files with 24 additions and 4 deletions

View File

@@ -63,6 +63,12 @@ public class LithoRecyclerViewDescriptor extends NodeDescriptor<LithoRecylerView
return 1;
}
@Override
public int getAXChildCount(LithoRecylerView node) throws Exception {
final NodeDescriptor descriptor = descriptorForClass(ViewGroup.class);
return descriptor.getAXChildCount(node);
}
@Override
public Object getChildAt(LithoRecylerView node, int index) throws Exception {
// TODO T39526148 account for the case above
@@ -77,6 +83,12 @@ public class LithoRecyclerViewDescriptor extends NodeDescriptor<LithoRecylerView
return DebugSection.getRootInstance(childrenViews);
}
@Override
public Object getAXChildAt(LithoRecylerView node, int index) throws Exception {
final NodeDescriptor descriptor = descriptorForClass(ViewGroup.class);
return descriptor.getAXChildAt(node, index);
}
@Override
public List<Named<FlipperObject>> getData(LithoRecylerView node) throws Exception {
final List<Named<FlipperObject>> props = new ArrayList<>();
@@ -86,6 +98,12 @@ public class LithoRecyclerViewDescriptor extends NodeDescriptor<LithoRecylerView
return props;
}
@Override
public List<Named<FlipperObject>> getAXData(LithoRecylerView node) throws Exception {
final NodeDescriptor descriptor = descriptorForClass(ViewGroup.class);
return descriptor.getAXData(node);
}
@Override
public void setValue(LithoRecylerView node, String[] path, FlipperDynamic value)
throws Exception {

View File

@@ -58,8 +58,9 @@ public class LithoViewDescriptor extends NodeDescriptor<LithoView> {
}
@Override
public int getAXChildCount(LithoView node) {
return node.getChildCount();
public int getAXChildCount(LithoView node) throws Exception {
final NodeDescriptor descriptor = descriptorForClass(ViewGroup.class);
return descriptor.getAXChildCount(node);
}
@Override
@@ -68,8 +69,9 @@ public class LithoViewDescriptor extends NodeDescriptor<LithoView> {
}
@Override
public @Nullable Object getAXChildAt(LithoView node, int index) {
return node.getChildAt(index);
public @Nullable Object getAXChildAt(LithoView node, int index) throws Exception {
final NodeDescriptor descriptor = descriptorForClass(ViewGroup.class);
return descriptor.getChildAt(node, index);
}
@Override