diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java index 05c267e0580011..5b9d178320e76a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java @@ -30,6 +30,7 @@ import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; +import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; @@ -171,6 +172,14 @@ public void onInitializeAccessibilityNodeInfo( } } + @Override + public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(host, event); + if (((View) host).getParent() != null) { + ((View) host).getParent().requestSendAccessibilityEvent(host, event); + } + } + @Override public boolean performAccessibilityAction(View host, int action, Bundle args) { if (action == AccessibilityNodeInfo.ACTION_CLICK) { @@ -527,11 +536,12 @@ public int incrementAndGetEventCounter() { */ public void maybeSetAccessibilityError( int eventCounter, @Nullable String accessibilityErrorMessage) { - if (!canUpdateWithEventCount(eventCounter) || accessibilityErrorMessage == null) { + if (!canUpdateWithEventCount(eventCounter)) { return; } - announceForAccessibility("Invalid input " + accessibilityErrorMessage); - setTag(R.id.accessibility_error, null); + + setTag(R.id.accessibility_error, accessibilityErrorMessage); + sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } public void maybeSetTextFromJS(ReactTextUpdate reactTextUpdate) {