Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 66d27d8

Browse files
committed
fix set text'
1 parent 7dd54f6 commit 66d27d8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

shell/platform/android/io/flutter/view/AccessibilityBridge.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
635635
}
636636

637637
// These are non-ops on older devices. Attempting to interact with the text will cause Talkback
638-
// to read the
639-
// contents of the text box instead.
638+
// to read the contents of the text box instead.
640639
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) {
641640
if (semanticsNode.hasAction(Action.SET_SELECTION)) {
642641
result.addAction(AccessibilityNodeInfo.ACTION_SET_SELECTION);
@@ -652,6 +651,14 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
652651
}
653652
}
654653

654+
// Set text APIs aren't available until API 21.
655+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
656+
if (semanticsNode.hasAction(Action.SET_TEXT)) {
657+
Log.e(TAG, "add action yo");
658+
result.addAction(AccessibilityNodeInfo.ACTION_SET_TEXT);
659+
}
660+
}
661+
655662
if (semanticsNode.hasFlag(Flag.IS_BUTTON) || semanticsNode.hasFlag(Flag.IS_LINK)) {
656663
result.setClassName("android.widget.Button");
657664
}

0 commit comments

Comments
 (0)