@@ -1134,8 +1134,8 @@ - (void)accessibilityElementDidBecomeFocused {
11341134 }
11351135}
11361136
1137- - (BOOL )isAccessibilityElement {
1138- return _accessibilityEnabled;
1137+ - (BOOL )accessibilityElementsHidden {
1138+ return ! _accessibilityEnabled;
11391139}
11401140
11411141@end
@@ -1144,6 +1144,17 @@ - (BOOL)isAccessibilityElement {
11441144 * Hides `FlutterTextInputView` from iOS accessibility system so it
11451145 * does not show up twice, once where it is in the `UIView` hierarchy,
11461146 * and a second time as part of the `SemanticsObject` hierarchy.
1147+ *
1148+ * This prevents the `FlutterTextInputView` from receiving the focus
1149+ * due to swipping gesture.
1150+ *
1151+ * There are other cases the `FlutterTextInputView` may receive
1152+ * focus. One example is during screen changes, the accessibility
1153+ * tree will undergo a dramatic structural update. The Voiceover may
1154+ * decide to focus the `FlutterTextInputView` that is not involved
1155+ * in the structural update instead. If that happens, the
1156+ * `FlutterTextInputView` will make a best effort to direct the
1157+ * focus back to the `SemanticsObject`.
11471158 */
11481159@interface FlutterTextInputViewAccessibilityHider : UIView {
11491160}
@@ -1154,15 +1165,6 @@ @implementation FlutterTextInputViewAccessibilityHider {
11541165}
11551166
11561167- (BOOL )accessibilityElementsHidden {
1157- // We are hiding this accessibility element.
1158- // There are 2 accessible elements involved in text entry in 2 different parts of the view
1159- // hierarchy. This `FlutterTextInputView` is injected at the top of key window. We use this as a
1160- // `UITextInput` protocol to bridge text edit events between Flutter and iOS.
1161- //
1162- // We also create ur own custom `UIAccessibilityElements` tree with our `SemanticsObject` to
1163- // mimic the semantics tree from Flutter. We want the text field to be represented as a
1164- // `TextInputSemanticsObject` in that `SemanticsObject` tree rather than in this
1165- // `FlutterTextInputView` bridge which doesn't appear above a text field from the Flutter side.
11661168 return YES ;
11671169}
11681170
@@ -1260,7 +1262,7 @@ - (void)showTextInput {
12601262 // Adds a delay to prevent the text view from receiving accessibility
12611263 // focus in case it is activated during semantics updates.
12621264 //
1263- // One comment case is when the app navigating to a page with an auto
1265+ // One common case is when the app navigates to a page with an auto
12641266 // focused text field. The text field will activate the FlutterTextInputView
12651267 // with a semantics update sent to the engine. The voiceover will focus
12661268 // the newly attached active view while performing accessibility update.
0 commit comments