WebContentsView background doesn't cover existing views until pageload finishes
- Dominant language
- C++
- Stars
- 123k
- Forks
- 17.5k
- Avg merge
- 14h 28m
- Merged PRs (30d)
- 870
Description
### Preflight Checklist
- [x] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [x] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a bug report that matches the one I want to file, without success.
### Electron Version
37.0.0-beta.2
### What operating system(s) are you using?
macOS
### Operating System Version
macOS Sequoia 15.5
### What arch are you using?
arm64 (including Apple Silicon)
### Last Known Working Electron version
35.0.0-alpha.2
### Expected Behavior
When a WebContentsView with a non-transparent background color is added to a window, that background should cover existing child views that are earlier in the stacking order regardless of whether the new view has finished loading.
https://github.com/user-attachments/assets/20c8d8c3-4b94-4bad-9d49-3c5757d79793
### Actual Behavior
The background color of the new view doesn't render on top of existing views until it finishes loading. If no other child view is present the background is visible immediately; otherwise, the existing child view covers it until the load finishes. There's also a brief flicker of the background before the existing view covers it.
https://github.com/user-attachments/assets/60d642c9-1be9-434b-a566-d124f602f0c9
### Testcase Gist URL
https://gist.github.com/rf-figma/9ed0a7c5130d0ad91a851b5fad03eeed
### Additional Information
This works as expected in 35.0.0-alpha.2 and fails in 35.0.0-alpha.3 and all newer versions I tried, including the latest beta. I would guess that it's caused by #45238 (the backport of #44628).
Contributor guide
Assessment
This issue has not been assessed yet.