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]: White frames appear when adding BrowserView with already loaded page #37201
Comments
Does FWIW I don't see any flashing on Ubuntu. Also Electron 20 is EOL. |
Hey @Prinzhorn This is not something desired |
Either make it white via https://www.electronjs.org/docs/latest/api/browser-view#viewsetbackgroundcolorcolor-experimental or maybe try my other suggestion and translate the "invisible" views off-screen using |
Hello, Every time when I add a new In my use case, we have a tab management feature, which does not look native when the user switches between tabs. |
The way to reproduce it with one
|
BrowserView
s
I noticed that
cc @stewartlord @codebytere Do you think we can fix it somehow in Electron? After a quick reading of Electron's source code, I think this is a Chromium bug. If you have any recommendations on what should be our next steps it will be very helpful! |
I also found an error logged every time the view flickers on Fiddle.
|
code snippet// Modules to control application life and create native browser window
const {app, BrowserWindow, BrowserView} = require('electron')
app.whenReady().then(async () => {
const win = new BrowserWindow({
width: 800,
height: 600,
backgroundColor: 'black'
})
const view1 = new BrowserView()
view1.setBackgroundColor('white');
win.addBrowserView(view1);
view1.setBounds({ x: 0, y: 0, width: 800, height: 600 })
await view1.webContents.loadURL('https://electronjs.org/')
setInterval(() => {
win.removeBrowserView(view1);
setTimeout(() => {
win.addBrowserView(view1);
view1.setBounds({ x: 800, y: 0, width: 800, height: 600 })
setTimeout(() => view1.setBounds({ x: 0, y: 0, width: 800, height: 600 }), 20)
}, 1000);
}, 3000);
}) Perhaps there is an underlying race condition here? |
Upon further testing, the workaround above only works on high-end Macs. Glitches will still appear on lower-end devices where the amount of resources is less. 😢 |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
bump |
Hi team, I use I used this code to reproduce (it is compatible with my custom build and official one):
Do you have any other recommendations or ideas? |
Also, I tried to use a short delay (100ms) before showing new contents after it is attached. However, it reminds me the same hack @kevinlinv described above. Probably it will not work in lower-end devices where the amount of resources is less. I am interested if there is any other way to wait for content to be painted rather than use hard-coded delay? 🤔 |
Bump |
same problem here |
same problem here. |
Echo that. Makes the UI look very buggy, unfortunately. Haven't found any good workarounds yet. |
To locate root reason for this bug I tried to dig into Chromium sources to see how tab switching implemented in browser itself, but I was not quite successful in this endeavor. If someone more experienced with Chromium codebase is reading this comment, please advice where to look for 🙏 |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
bump |
Preflight Checklist
Electron Version
20.1.4
What operating system are you using?
macOS
Operating System Version
Ventura 13.2
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
In my use case, I need to keepBrowserView
s in memory and switch them.To switch I useremoveBrowserView
andsetBrowserView
APIs like this:I expect that this switching will be experienced by users as tab switching in the browser. For example, if you open two tabshttps://www.electronjs.org/ & https://www.electronjs.org/docs/latest/api/app, and will start switching between them you will notice that the website header remains black (for this specific example with electronjs.rg).In my use case, I need to add
BrowserView
with an already loaded page to the window. When I do this I am able to notice a white glitch even though I set another color as a background color for the window.This bug is not reproducible if hardware acceleration is turned off. (
app.disableHardwareAcceleration()
)Actual Behavior
It works as desired on Windows 11.
On MacOS some white frames appear and make the user's experience less native.
Screen.Recording.2023-02-09.at.3.36.08.pm.mov
Can we get it fixed or give me suggestions on how I can perform a workaround, please?
Testcase Gist URL
https://gist.github.com/0c99927c913ac5971facd861dd656d8b
Additional Information
No response
The text was updated successfully, but these errors were encountered: