A few mini-fixes for the accessibility layout inspector
Summary: - fix mutual selection of elements in ax and non-ax tree (simplifies linkedNode logic as well) - remove unneeded extraInfo attributes (focused, nonAXwithAXchild, & hasAXNode were not/no longer being used) - use 50/50 fixed width view for trees when both are visible Reviewed By: jknoxville Differential Revision: D16390355 fbshipit-source-id: bbf9ea887f8f1035df8b4b0562ddcc4de291f004
This commit is contained in:
committed by
Facebook Github Bot
parent
3ed71680a1
commit
f591475f85
@@ -551,7 +551,7 @@ public class InspectorFlipperPlugin implements FlipperPlugin {
|
||||
|
||||
private boolean hasAXNode(FlipperObject node) {
|
||||
FlipperObject extraInfo = node.getObject("extraInfo");
|
||||
return extraInfo != null && extraInfo.getBoolean("hasAXNode");
|
||||
return extraInfo != null && extraInfo.getBoolean("linkedNode");
|
||||
}
|
||||
|
||||
public SearchResultNode searchTree(String query, Object obj, boolean axEnabled) throws Exception {
|
||||
|
||||
@@ -216,7 +216,8 @@ public class ApplicationDescriptor extends NodeDescriptor<ApplicationWrapper> {
|
||||
|
||||
@Override
|
||||
public FlipperObject getExtraInfo(ApplicationWrapper node) {
|
||||
return new FlipperObject.Builder().put("hasAXNode", true).build();
|
||||
// Application node is it's own linkedNode because it shows up in both the ax and non-ax tree
|
||||
return new FlipperObject.Builder().put("linkedNode", getId(node)).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -77,7 +77,7 @@ public class FragmentDescriptor extends NodeDescriptor<Fragment> {
|
||||
|
||||
@Override
|
||||
public FlipperObject getExtraInfo(Fragment node) {
|
||||
return new FlipperObject.Builder().put("nonAXWithAXChild", true).build();
|
||||
return new FlipperObject.Builder().put("expandWithParent", true).build();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -445,10 +445,9 @@ public class ViewDescriptor extends NodeDescriptor<View> {
|
||||
|
||||
@Override
|
||||
public FlipperObject getExtraInfo(View node) {
|
||||
return new FlipperObject.Builder()
|
||||
.put("focused", AccessibilityUtil.isAXFocused(node))
|
||||
.put("hasAXNode", true)
|
||||
.build();
|
||||
// Views of all kinds are their own linked node because they show up in both the ax and non-ax
|
||||
// tree
|
||||
return new FlipperObject.Builder().put("linkedNode", getId(node)).build();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -307,13 +307,13 @@ public class DebugComponentDescriptor extends NodeDescriptor<DebugComponent> {
|
||||
|
||||
if (hostView != null) {
|
||||
try {
|
||||
extraInfo.put("linkedAXNode", descriptor.getId(hostView));
|
||||
extraInfo.put("linkedNode", descriptor.getId(hostView));
|
||||
} catch (Exception ignored) {
|
||||
// doesn't have linked node descriptor
|
||||
}
|
||||
} else if (lithoView != null) {
|
||||
try {
|
||||
extraInfo.put("linkedAXNode", descriptor.getId(lithoView));
|
||||
extraInfo.put("linkedNode", descriptor.getId(lithoView)).put("expandWithParent", true);
|
||||
} catch (Exception ignored) {
|
||||
// doesn't add linked node descriptor
|
||||
}
|
||||
|
||||
@@ -101,7 +101,9 @@ public class InspectorFlipperPluginTest {
|
||||
.put("children", new FlipperArray.Builder().put("test"))
|
||||
.put("attributes", new FlipperArray.Builder())
|
||||
.put("decoration", (String) null)
|
||||
.put("extraInfo", new FlipperObject.Builder().put("hasAXNode", true))
|
||||
.put(
|
||||
"extraInfo",
|
||||
new FlipperObject.Builder().put("linkedNode", "com.facebook.flipper"))
|
||||
.build()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user