mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Tell Android which SemanticsNodes are focusable (#4067)
A node is considered focusable if it contains information that is interesing to the user. A node that doesn't add any semantic information of its own should not be focusable. It's expected that such a node has children, who have smeantics information and are therefore focusable. Fixes https://github.com/flutter/flutter/issues/11179
This commit is contained in:
parent
83ce8c40b1
commit
ccf68cdcb6
@ -95,6 +95,7 @@ class AccessibilityBridge extends AccessibilityNodeProvider implements BasicMess
|
||||
result.setPackageName(mOwner.getContext().getPackageName());
|
||||
result.setClassName("Flutter"); // TODO(goderbauer): Set proper class names
|
||||
result.setSource(mOwner, virtualViewId);
|
||||
result.setFocusable(object.isFocusable());
|
||||
|
||||
if (object.parent != null) {
|
||||
assert object.id > 0;
|
||||
@ -144,7 +145,6 @@ class AccessibilityBridge extends AccessibilityNodeProvider implements BasicMess
|
||||
}
|
||||
if ((object.actions & SEMANTICS_ACTION_INCREASE) != 0
|
||||
|| (object.actions & SEMANTICS_ACTION_DECREASE) != 0 ) {
|
||||
result.setFocusable(true);
|
||||
result.setClassName("android.widget.SeekBar");
|
||||
if ((object.actions & SEMANTICS_ACTION_INCREASE) != 0) {
|
||||
result.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
|
||||
@ -509,6 +509,10 @@ class AccessibilityBridge extends AccessibilityNodeProvider implements BasicMess
|
||||
return this;
|
||||
}
|
||||
|
||||
boolean isFocusable() {
|
||||
return flags != 0 || label != null || (actions & ~SEMANTICS_ACTION_SCROLLABLE) != 0;
|
||||
}
|
||||
|
||||
void updateRecursively(float[] ancestorTransform, Set<SemanticsObject> visitedObjects, boolean forceUpdate) {
|
||||
visitedObjects.add(this);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user