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 {
780780
781781- (void )applicationBecameActive : (NSNotification *)notification  {
782782  TRACE_EVENT0 (" flutter" " applicationBecameActive" 
783+   self.view .accessibilityElementsHidden  = NO ;
783784  if  (_viewportMetrics.physical_width )
784785    [self  surfaceUpdated: YES ];
785786  [self  goToApplicationLifecycle: @" AppLifecycleState.resumed" 
786787}
787788
788789- (void )applicationWillResignActive : (NSNotification *)notification  {
789790  TRACE_EVENT0 (" flutter" " applicationWillResignActive" 
791+   self.view .accessibilityElementsHidden  = YES ;
790792  [self  goToApplicationLifecycle: @" AppLifecycleState.inactive" 
791793}
792794
Original file line number Diff line number Diff line change @@ -746,6 +746,25 @@ - (void)testHideOverlay {
746746  engine.viewController  = nil ;
747747}
748748
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+ 
749768- (void )testNotifyLowMemory  {
750769  FlutterEnginePartialMock* mockEngine = [[FlutterEnginePartialMock alloc ] init ];
751770  FlutterViewController* viewController = [[FlutterViewController alloc ] initWithEngine: mockEngine
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments