This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
shell/platform/darwin/ios/framework/Source Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -780,13 +780,15 @@ - (void)dealloc {
780
780
781
781
- (void )applicationBecameActive : (NSNotification *)notification {
782
782
TRACE_EVENT0 (" flutter" , " applicationBecameActive" );
783
+ self.view .accessibilityElementsHidden = NO ;
783
784
if (_viewportMetrics.physical_width )
784
785
[self surfaceUpdated: YES ];
785
786
[self goToApplicationLifecycle: @" AppLifecycleState.resumed" ];
786
787
}
787
788
788
789
- (void )applicationWillResignActive : (NSNotification *)notification {
789
790
TRACE_EVENT0 (" flutter" , " applicationWillResignActive" );
791
+ self.view .accessibilityElementsHidden = YES ;
790
792
[self goToApplicationLifecycle: @" AppLifecycleState.inactive" ];
791
793
}
792
794
Original file line number Diff line number Diff line change @@ -746,6 +746,25 @@ - (void)testHideOverlay {
746
746
engine.viewController = nil ;
747
747
}
748
748
749
+ - (void )testHideA11yElements {
750
+ FlutterDartProject* project = [[FlutterDartProject alloc ] init ];
751
+ FlutterEngine* engine = [[FlutterEngine alloc ] initWithName: @" foobar" project: project];
752
+ [engine createShell: @" " libraryURI: @" " initialRoute: nil ];
753
+ FlutterViewController* realVC = [[FlutterViewController alloc ] initWithEngine: engine
754
+ nibName: nil
755
+ bundle: nil ];
756
+ XCTAssertFalse (realVC.view .accessibilityElementsHidden );
757
+ [[NSNotificationCenter defaultCenter ]
758
+ postNotificationName: UIApplicationWillResignActiveNotification
759
+ object: nil ];
760
+ XCTAssertTrue (realVC.view .accessibilityElementsHidden );
761
+ [[NSNotificationCenter defaultCenter ]
762
+ postNotificationName: UIApplicationDidBecomeActiveNotification
763
+ object: nil ];
764
+ XCTAssertFalse (realVC.view .accessibilityElementsHidden );
765
+ engine.viewController = nil ;
766
+ }
767
+
749
768
- (void )testNotifyLowMemory {
750
769
FlutterEnginePartialMock* mockEngine = [[FlutterEnginePartialMock alloc ] init ];
751
770
FlutterViewController* viewController = [[FlutterViewController alloc ] initWithEngine: mockEngine
You can’t perform that action at this time.
0 commit comments