question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Electron 11 only shows Web Content after resize, minimize or drag Main Window

See original GitHub issue

Describe the bug I’m building an app with Electron, Capacitor, Ionic and Angular.

My app runs smooth without any problems if I use electron version 10.2.0, but if I upgrade to Electron 11.2.0 my app starts with an empty white screen. The strange thing is, if I inspect the page the HTML is there but the window shows only white (black if dark mode). My apps starts displaying if I do one of the following:

  • Resize the app window
  • Move the window;
  • Minimize or maximize the window;
  • Run for example a registered shortcut command (CTRL + H for a MessageBox with App help screen);

It looks like the main windows looses focus or stops to render, but then when I click, min/max the windows or drag it gain focus and continuous to render… I already tried to force focus without success.

MainWindow.focus();

Any hint on what may be causing this?

To Reproduce Update to Electron from 10.2.0 or 10.3.0 to 11.2.0.

Expected behavior App should run without the need to resize, move or minimize/maximize the window.

Screenshots App shows nothing until something is done with the window (drag, min/max, loose focus, etc). image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Electron 11.2.0
  • Capacitor 2.4.6
  • Capacitor Electron 1.3.2

Additional context If I try to force MainWindow.show(); in my main.ts after the app inits it shows and render the web page, but it breaks the splashcreen, showing an white area (same as the window size) around the splashscreen image…

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
IT-MikeScommented, Feb 3, 2021

I pushed out a platform update (v1.3.3) that reverts back to electron ~10.3.1 so new users wont have a ton of frustrations. I will keep this issue open until the issue is resolved.

If you need electron versions >10, then you can freely update it manually in your project.

Open a terminal in the electron folder of your project and just use npm i electron@^XX.XX.XX with your required version. Sam goes for needing to downgrade for any reason too.

0reactions
JuliusSkrisacommented, May 20, 2022

I am somehow still seeing this issue on 4.1.0 version. with Electron 14. when I set hideMainWindowOnLaunch to true, its even worse and no window will show up after splash screen is hidden. Even thought I can see logs from both renderer and main processes running normally in the background. Just the window has issues to show up.

for now setting the timeout for this.MainWindow.show() solves this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Preventing window resizing | Electron Projects
If you don't want to deal with scaling and resizing and want to restrict the size of the screen, you can do so...
Read more >
Window Customization | Electron
In this tutorial, we will be going over the various use-cases for window customization on macOS, Windows, and Linux.
Read more >
Frameless window with controls in electron (Windows)
-webkit-app-region: drag on your 'title bar' region will make it so that you can drag it around as is common with windows.
Read more >
How to Make Frameless Window for Electron with Custom ...
By setting -wekit-app-region to drag , you've just told Electron you want this element to receive drag events. Now you can drag the...
Read more >
All of the Documentation | Electron - GitHub Pages
app. Control your application's event lifecycle. Process: Main. The following example shows how to quit the application when the last window ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found