-
Notifications
You must be signed in to change notification settings - Fork 17.1k
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
36.4.0
What operating system(s) are you using?
Windows
Operating System Version
windows 11
What arch are you using?
x64
Last Known Working Electron version
29.4.6
Does the issue also appear in Chromium / Google Chrome?
No
Expected Behavior
When the same browserView is added to a browserWindow multiple times, the visibility of the pages in the browserView does not change.
Actual Behavior
When the same browserView is added to a browserWindow multiple times, the visibility of the pages in the browserView quickly changes from visible to hidden and then to visible.
Testcase Gist URL
https://gist.github.com/mai-121/43a7ad52f16e6c86b0fc1369c84fa97a
Additional Information
After the BrowserView module was refactored in Electron 30, the behavior of the addBrowserView API changed. When the same browserView is added multiple times to a browserWindow, the browserView will first be removed and then re-added.
Specifically, this causes a jump in the page's visibility inside the browserView, and the visibilitychange event is triggered unexpectedly.
The impl of 'addBrowserView' in different versions:
electron 29: https://github.com/electron/electron/blob/v29.4.6/shell/browser/api/electron_api_base_window.cc#L762
electron 30: https://github.com/electron/electron/blob/v30.0.0/lib/browser/api/browser-window.ts#L178
No response