New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: BrowserWindow backgroundColor doesn't work in Electron 14 and 15 #30759
Comments
@samuelmaddock this appears to only be happening within a certain range 🤔 it works properly on |
Same bug here on 14.0.0 final on win 7. |
It's fixed after the introduction of #30193 |
This works: electron/shell/browser/api/electron_api_web_contents.cc Lines 1373 to 1378 in dd7aeda
This does not work: -rwhv->SetBackgroundColor(web_preferences->GetBackgroundColor());
+rwhv->SetBackgroundColor(SK_ColorRED); 🤔🤔🤔 |
Sometimes on startup, you can see the correct background color set, then immediately gets replaced with a white background color. I believe initially it shows the native window color followed by the RenderWidgetHostView's background. Setting the background to transparent allows the native window's background color to show up:
#30193 may have actually broken |
The white background color is coming from the page background color defined in Blink: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/exported/web_view_impl.cc;l=3049-3058;drc=98898daa2e8f46ff098cea1f2e218f8a8266c838 // Use the page background color if this is the WebView of the main frame.
if (MainFrameImpl())
return page_base_background_color_; To update this color, we need to call |
#30777 will solve the problem for Electron 14 and 15. |
@andmm your comment was deleted as a violation of the Electron Code of Conduct. You may consider this an official warning. Please do not interact with the project for 24 hours. After that, please look through your open issues and edit them to ensure they're entirely on-topic, and we can continue the discussion here about the best way to go forward. |
Preflight Checklist
Electron Version
14.0.0-beta.11
What operating system are you using?
Windows
Operating System Version
Windows 10 21H1, macOS 11.5.1
What arch are you using?
x64
Last Known Working Electron version
14.0.0-beta.10
Expected Behavior
Creating a BrowserWindow with the
backgroundColor
option results in the new window displaying that color behind the transparent WebContents.Actual Behavior
Creating a BrowserWindow with the
backgroundColor
option results in the new window displaying a white background color behind the transparent WebContents.Testcase Gist URL
https://gist.github.com/4256f388d41ef0d974645a11ab72b1fe
Additional Information
The problematic version was discovered using Electron Fiddle's bisect feature.
v14.0.0-beta.10...v14.0.0-beta.11
#30136 seems related
I'm not seeing this behavior in a testing build of current
main
(8007d01).I'm looking into a fix, will update as progress is made.
The text was updated successfully, but these errors were encountered: