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
fix: css transparent background being lost #32593
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are running into a related issue in Teams, which unfortunately does not have a simple repro that I can share. I am discussing it 1:1 with @codebytere
c3417e2
to
8925074
Compare
spec-main/fixtures/apps/background-color-transparent/renderer.js
Outdated
Show resolved
Hide resolved
8925074
to
fa8e95e
Compare
spec-main/fixtures/apps/background-color-transparent/renderer.js
Outdated
Show resolved
Hide resolved
fa8e95e
to
73b0451
Compare
73b0451
to
04fbad6
Compare
Release Notes Persisted
|
I was unable to backport this PR to "14-x-y" cleanly; |
I was unable to backport this PR to "15-x-y" cleanly; |
I have automatically backported this PR to "16-x-y", please check out #32648 |
I have automatically backported this PR to "17-x-y", please check out #32649 |
@VerteDinde has manually backported this PR to "14-x-y", please check out #33507 |
Description of Change
Closes #31862.
Background colors are a bit of a mess right now in Chromium. They're working on cleaning things up, but in the process have made it harder to determine background color precedence as well as how we can override certain defaults. If we in Electron set
const mainWindow = new BrowserWindow({ frame: false, transparent: true, vibrancy:'under-window' })
and then set the CSSbackground
togreen
the initial content background color gets set togreen
and at no point after that can be set back totransparent
via CSS. This problem was exascerbated by CL:2695928 but happened before that too - before that settingbackground: transparent
would work for about ~4 seconds before being overridden by the initial color. This is only an issue for transparency, as Chromium does not have the same concept of transparency as we do and disfavors or disallows it being set in various places along background color codepaths.@VerteDinde and I paired on this for a few hours last week and found that above Google doc as well as a
content::WebContentsObserver
we could override to address this issue in the short term. As such, this PR aims to fix this issue by overridingOnBackgroundColorChanged
method to correct transparency when the background color is changed via CSS.There is most likely a better solution for this, but the chief goal of this PR is to unblock the
17-x-y
release which is why i'm putting it up in its current state.Tested with https://gist.github.com/b23b66ba4e246effc5d29cecb0a40e26
Checklist
npm test
passesRelease Notes
Notes: Fixed an issue where frameless vibrant windows would not show transparency correctly on macOS.