未验证 提交 272be27f 编写于 作者: J Jonah Williams 提交者: GitHub

update live region to trigger on label change, remove manual trigger (#6248)

上级 7a9b430d
......@@ -733,8 +733,12 @@ class AccessibilityBridge
}
sendAccessibilityEvent(event);
}
if (object.hasFlag(Flag.IS_LIVE_REGION) && !object.hadFlag(Flag.IS_LIVE_REGION)) {
sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
if (object.hasFlag(Flag.IS_LIVE_REGION)) {
String label = object.label == null ? "" : object.label;
String previousLabel = object.previousLabel == null ? "" : object.label;
if (!label.equals(previousLabel) || !object.hadFlag(Flag.IS_LIVE_REGION)) {
sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
}
} else if (object.hasFlag(Flag.IS_TEXT_FIELD) && object.didChangeLabel()
&& mInputFocusedObject != null && mInputFocusedObject.id == object.id) {
// Text fields should announce when their label changes while focused. We use a live
......@@ -865,17 +869,6 @@ class AccessibilityBridge
sendAccessibilityEvent(e);
break;
}
// Requires that the node id provided corresponds to a live region, or TalkBack will
// ignore the event. The event will cause talkback to read out the new label even
// if node is not focused.
case "updateLiveRegion": {
Integer nodeId = (Integer) annotatedEvent.get("nodeId");
if (nodeId == null) {
return;
}
sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
break;
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册