File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
packages/kit-headless/src/components/modal Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -21,23 +21,27 @@ export function useModal() {
21
21
if ( animationDuration !== '0s' ) {
22
22
modal . addEventListener (
23
23
'animationend' ,
24
- ( ) => {
25
- delete modal . dataset . closing ;
26
- modal . classList . remove ( 'modal-closing' ) ;
27
- enableBodyScroll ( modal ) ;
28
- modal . close ( ) ;
24
+ ( e ) => {
25
+ if ( e . target === modal ) {
26
+ delete modal . dataset . closing ;
27
+ modal . classList . remove ( 'modal-closing' ) ;
28
+ enableBodyScroll ( modal ) ;
29
+ modal . close ( ) ;
30
+ }
29
31
} ,
30
32
{ once : true } ,
31
33
) ;
32
34
}
33
35
if ( transitionDuration !== '0s' ) {
34
36
modal . addEventListener (
35
37
'transitionend' ,
36
- ( ) => {
37
- delete modal . dataset . closing ;
38
- modal . classList . remove ( 'modal-closing' ) ;
39
- enableBodyScroll ( modal ) ;
40
- modal . close ( ) ;
38
+ ( e ) => {
39
+ if ( e . target === modal ) {
40
+ delete modal . dataset . closing ;
41
+ modal . classList . remove ( 'modal-closing' ) ;
42
+ enableBodyScroll ( modal ) ;
43
+ modal . close ( ) ;
44
+ }
41
45
} ,
42
46
{ once : true } ,
43
47
) ;
You can’t perform that action at this time.
0 commit comments