File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -134,8 +134,26 @@ export class Dialog extends ObserveSlotPresence(AlertDialog, [
134134        ` ; 
135135    } 
136136
137+     /** 
138+      * Returns a visually hidden dismiss button for mobile screen reader accessibility. 
139+      * This button is placed before and after dialog content to allow mobile screen reader 
140+      * users (particularly VoiceOver on iOS) to easily dismiss the overlay. 
141+      */ 
142+     protected  get  dismissHelper ( ) : TemplateResult  { 
143+         return  html ` 
144+             < div  class ="visually-hidden ">  
145+                 < button  
146+                     tabindex ="-1 " 
147+                     aria-label ="Dismiss " 
148+                     @click =${ this . close }  
149+                 > </ button >  
150+             </ div >  
151+         ` ; 
152+     } 
153+ 
137154    protected  override  render ( ) : TemplateResult  { 
138155        return  html ` 
156+             ${ this . dismissHelper }  
139157            < div  class ="grid ">  
140158                ${ this . renderHero ( ) } ${ this . renderHeading ( ) }  
141159                ${ this . error  
@@ -153,6 +171,7 @@ export class Dialog extends ObserveSlotPresence(AlertDialog, [
153171                ${ this . hasButtons  ? this . renderButtons ( )  : nothing }  
154172                ${ this . dismissable  ? this . renderDismiss ( )  : nothing }  
155173            </ div >  
174+             ${ this . dismissHelper }  
156175        ` ; 
157176    } 
158177
Original file line number Diff line number Diff line change 6666    inline-size :  100%  ;
6767    display :  grid;
6868}
69+ 
70+ .visually-hidden  {
71+     border :  0 ;
72+     clip :  rect (0 ,  0 ,  0 ,  0 );
73+     clip-path :  inset (50%  );
74+     height :  10px  ;
75+     margin :  0  -1px   -1px   0 ;
76+     overflow :  hidden;
77+     padding :  0 ;
78+     position :  absolute;
79+     width :  10px  ;
80+     white-space :  nowrap;
81+     appearance :  none;
82+ }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments