File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -249,11 +249,12 @@ class EditorWindow extends ProjectRunningWindow {
249249 } ;
250250
251251 this . window . webContents . on ( 'will-prevent-unload' , ( ) => {
252- // Using showMessageBoxSync immediately within the event handler breaks focus on
253- // Windows - https://github.com/TurboWarp/desktop/issues/1245.
254- // Instead, we'll let the window refuse the unload, then show our own prompt after
255- // the event finishes and manually close it ourselves instead of relying on Electron.
256- queueMicrotask ( ( ) => {
252+ // Using showMessageBoxSync synchronously in the event handler causes broken focus on Windows.
253+ // See https://github.com/TurboWarp/desktop/issues/1245
254+ // To work around that, we'll let the will-prevent-unload event happen so the window stays open,
255+ // then show our own prompt after a very short delay so that window focus doesn't break.
256+
257+ setTimeout ( ( ) => {
257258 const choice = dialog . showMessageBoxSync ( this . window , {
258259 title : APP_NAME ,
259260 type : 'info' ,
@@ -270,7 +271,7 @@ class EditorWindow extends ProjectRunningWindow {
270271 if ( choice === 1 ) {
271272 this . window . destroy ( ) ;
272273 }
273- } )
274+ } ) ;
274275 } ) ;
275276
276277 this . window . on ( 'page-title-updated' , ( event , title , explicitSet ) => {
You can’t perform that action at this time.
0 commit comments