File tree 1 file changed +21
-8
lines changed
1 file changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ function ExpandedCard(props) {
58
58
) ;
59
59
60
60
let dialogRef ;
61
+ let backdropRef ;
61
62
let tagsInputRef ;
62
63
let editorContainerRef ;
63
64
@@ -358,9 +359,24 @@ function ExpandedCard(props) {
358
359
props . onClose ( ) ;
359
360
}
360
361
362
+ function handleBackdropClick ( e ) {
363
+ if ( e . target === backdropRef ) {
364
+ handleDialogCancel ( ) ;
365
+ }
366
+ }
367
+
361
368
return (
362
369
< Portal >
363
- < div class = "dialog-backdrop" >
370
+ < div
371
+ class = "dialog-backdrop"
372
+ onClick = { handleBackdropClick }
373
+ onKeyDown = { ( e ) =>
374
+ handleKeyDown ( e , ( event ) => handleBackdropClick ( event ) )
375
+ }
376
+ ref = { ( el ) => {
377
+ backdropRef = el ;
378
+ } }
379
+ >
364
380
< dialog
365
381
ref = { ( el ) => {
366
382
dialogRef = el ;
@@ -370,7 +386,8 @@ function ExpandedCard(props) {
370
386
handleKeyDown ( e , ( event ) => event . stopPropagation ( ) )
371
387
}
372
388
onCancel = { handleDialogCancel }
373
- use :clickOutside = { handleDialogCancel }
389
+ // TODO Doesn't work rn because it can be triggered by clicking image upload confirm button. Try again when new editor is implemented
390
+ // use:clickOutside={handleDialogCancel}
374
391
>
375
392
< div class = "dialog__body" >
376
393
< header class = "dialog__toolbar" >
@@ -460,12 +477,8 @@ function ExpandedCard(props) {
460
477
</ For >
461
478
</ div >
462
479
< div class = "dialog__content" >
463
- < style >
464
- { stacksStyle }
465
- </ style >
466
- < style >
467
- { stacksEditorStyle }
468
- </ style >
480
+ < style > { stacksStyle } </ style >
481
+ < style > { stacksEditorStyle } </ style >
469
482
< div
470
483
id = "editor-container"
471
484
autofocus
You can’t perform that action at this time.
0 commit comments