@@ -517,8 +517,28 @@ - (void)deleteBackward {
517517
518518@end
519519
520+ /* *
521+ * Hides `FlutterTextInputView` from iOS accessibility system so it
522+ * does not show up twice, once where it is in the `UIView` hierarchy,
523+ * and a second time as part of the `SemanticsObject` hierarchy.
524+ */
525+ @interface FlutterTextInputViewAccessibilityHider : UIView {
526+ }
527+
528+ @end
529+
530+ @implementation FlutterTextInputViewAccessibilityHider {
531+ }
532+
533+ - (BOOL )accessibilityElementsHidden {
534+ return YES ;
535+ }
536+
537+ @end
538+
520539@implementation FlutterTextInputPlugin {
521540 FlutterTextInputView* _view;
541+ FlutterTextInputViewAccessibilityHider* _inputHider;
522542}
523543
524544@synthesize textInputDelegate = _textInputDelegate;
@@ -528,6 +548,7 @@ - (instancetype)init {
528548
529549 if (self) {
530550 _view = [[FlutterTextInputView alloc ] init ];
551+ _inputHider = [[FlutterTextInputViewAccessibilityHider alloc ] init ];
531552 }
532553
533554 return self;
@@ -536,6 +557,7 @@ - (instancetype)init {
536557- (void )dealloc {
537558 [self hideTextInput ];
538559 [_view release ];
560+ [_inputHider release ];
539561
540562 [super dealloc ];
541563}
@@ -572,13 +594,15 @@ - (void)showTextInput {
572594 @" The application must have a key window since the keyboard client "
573595 @" must be part of the responder chain to function" );
574596 _view.textInputDelegate = _textInputDelegate;
575- [[UIApplication sharedApplication ].keyWindow addSubview: _view];
597+ [_inputHider addSubview: _view];
598+ [[UIApplication sharedApplication ].keyWindow addSubview: _inputHider];
576599 [_view becomeFirstResponder ];
577600}
578601
579602- (void )hideTextInput {
580603 [_view resignFirstResponder ];
581604 [_view removeFromSuperview ];
605+ [_inputHider removeFromSuperview ];
582606}
583607
584608- (void )setTextInputClient : (int )client withConfiguration : (NSDictionary *)configuration {
0 commit comments