Skip to content
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

Merged
merged 4 commits into from Jan 27, 2022
Merged

Conversation

codebytere
Copy link
Member

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 CSS background to green the initial content background color gets set to green and at no point after that can be set back to transparent via CSS. This problem was exascerbated by CL:2695928 but happened before that too - before that setting background: 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 overriding OnBackgroundColorChanged 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

Release Notes

Notes: Fixed an issue where frameless vibrant windows would not show transparency correctly on macOS.

@codebytere codebytere added semver/patch backwards-compatible bug fixes target/16-x-y labels Jan 24, 2022
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jan 24, 2022
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jan 25, 2022
Copy link
Contributor

@miniak miniak left a 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

@codebytere codebytere force-pushed the fix-bg-transparent branch 2 times, most recently from c3417e2 to 8925074 Compare January 26, 2022 10:31
spec-main/yarn.lock Outdated Show resolved Hide resolved
@codebytere codebytere deleted the fix-bg-transparent branch January 27, 2022 14:56
@release-clerk
Copy link

release-clerk bot commented Jan 27, 2022

Release Notes Persisted

Fixed an issue where frameless vibrant windows would not show transparency correctly on macOS.

@trop
Copy link
Contributor

trop bot commented Jan 27, 2022

I was unable to backport this PR to "14-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Jan 27, 2022

I was unable to backport this PR to "15-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Jan 27, 2022

I have automatically backported this PR to "16-x-y", please check out #32648

@trop
Copy link
Contributor

trop bot commented Jan 27, 2022

I have automatically backported this PR to "17-x-y", please check out #32649

@trop
Copy link
Contributor

trop bot commented Mar 29, 2022

@VerteDinde has manually backported this PR to "14-x-y", please check out #33507

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Vibrancy + Transparent background still broken on macOS on 16.0.0
5 participants