File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed 
packages/components/dialog/src Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,11 @@ export const DialogWithOverlayComponents: Story = {
246246        popover ?. togglePopover ( ) ; 
247247      } ; 
248248
249+       const  hidePopover  =  ( ) : void =>  { 
250+         const  popover  =  document . getElementById ( 'popover-example' )  as  HTMLElement  &  {  togglePopover ( ) : void } ; 
251+         popover ?. hidePopover ( ) ; 
252+       } ; 
253+ 
249254      dialog . innerHTML  =  ` 
250255        <span slot="title">Dialog with overlay components</span> 
251256        <div class="container"> 
@@ -280,7 +285,7 @@ export const DialogWithOverlayComponents: Story = {
280285               use sunlight to synthesize foods from carbon dioxide and water. 
281286            </section> 
282287            <footer> 
283-               <sl-button size="sm" variant="primary">Got it</sl-button> 
288+               <sl-button id="closeButton"  size="sm" variant="primary">Got it</sl-button> 
284289            </footer> 
285290          </sl-popover> 
286291
@@ -304,6 +309,8 @@ export const DialogWithOverlayComponents: Story = {
304309
305310      dialog . querySelector ( '#anchor' ) ?. addEventListener ( 'click' ,  onClickPopover ) ; 
306311
312+       dialog . querySelector ( '#closeButton' ) ?. addEventListener ( 'click' ,  hidePopover ) ; 
313+ 
307314      await  dialog . updateComplete ; 
308315
309316      dialog . showModal ( ) ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments