Fix live region logic (#14081)

This commit is contained in:
Dan Field 2019-12-02 15:49:15 -08:00 committed by GitHub
parent 0bf6c7429a
commit ea721ebf1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1377,16 +1377,7 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
}
sendAccessibilityEvent(event);
}
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)) {
sendWindowContentChangeEvent(object.id);
}
} else if (object.hasFlag(Flag.IS_TEXT_FIELD) && object.didChangeLabel()
&& inputFocusedSemanticsNode != null && inputFocusedSemanticsNode.id == object.id) {
// Text fields should announce when their label changes while focused. We use a live
// region tag to do so, and this event triggers that update.
if (object.hasFlag(Flag.IS_LIVE_REGION) && object.didChangeLabel()) {
sendWindowContentChangeEvent(object.id);
}
if (accessibilityFocusedSemanticsNode != null && accessibilityFocusedSemanticsNode.id == object.id