File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -337,21 +337,13 @@ const Preview: React.FC<PreviewProps> = props => {
337337 const { keyCode, key } = event ;
338338
339339 if ( keyCode === KeyCode . ESC || key === 'Escape' ) {
340- if ( escClosingRef . current ) {
341- return ;
342- }
343-
344340 escClosingRef . current = true ;
345341 openRef . current = false ;
346342 event . preventDefault ( ) ;
347343 if ( keyCode === KeyCode . ESC ) {
348344 event . stopPropagation ( ) ;
349345 }
350346 onClose ?.( ) ;
351-
352- setTimeout ( ( ) => {
353- escClosingRef . current = false ;
354- } , 0 ) ;
355347 return ;
356348 }
357349
@@ -387,6 +379,7 @@ const Preview: React.FC<PreviewProps> = props => {
387379 const onVisibleChanged = ( nextVisible : boolean ) => {
388380 if ( ! nextVisible ) {
389381 setLockScroll ( false ) ;
382+ escClosingRef . current = false ;
390383 }
391384 afterOpenChange ?.( nextVisible ) ;
392385 } ;
You can’t perform that action at this time.
0 commit comments