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

Commit c74778c

Browse files
committed
update
1 parent 037c429 commit c74778c

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ typedef NS_ENUM(NSInteger, FlutterFloatingCursorDragState) {
3838
- (void)showAutocorrectionPromptRectForStart:(NSUInteger)start
3939
end:(NSUInteger)end
4040
withClient:(int)client;
41-
- (void)waitForFirstFrame:(NSTimeInterval)timeout callback:(void (^)(BOOL didTimeout))callback;
4241
@end
4342

4443
#endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERTEXTINPUTDELEGATE_H_

shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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.

shell/platform/darwin/ios/framework/Source/accessibility_text_entry.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ - (NSString*)accessibilityLabel {
263263
NSString* label = [super accessibilityLabel];
264264
if (label != nil)
265265
return label;
266-
return _inactive_text_input.accessibilityLabel;
266+
return [self textInputSurrogate].accessibilityLabel;
267267
}
268268

269269
- (NSString*)accessibilityHint {
@@ -291,7 +291,7 @@ - (UIAccessibilityTraits)accessibilityTraits {
291291
// a keyboard entry control, thus adding support for text editing features, such as
292292
// pinch to select text, and up/down fling to move cursor.
293293
UIAccessibilityTraits results = [super accessibilityTraits] |
294-
_inactive_text_input.accessibilityTraits |
294+
[self textInputSurrogate].accessibilityTraits |
295295
UIAccessibilityTraitKeyboardKey;
296296
// We remove an undocumented flag to get rid of a bug where single-tapping
297297
// a text input field incorrectly says "empty line".

0 commit comments

Comments
 (0)