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
feat: add win.setTopBrowserView()
so that BrowserViews can be raised
#27007
Conversation
This is similar to removing and re-adding a browser view, but avoids a visible flicker as the browser view is not removed from the window when using `setTopBrowserView`. Note: if the given browser view is not attached to the window, it will be added. This commit contains the macOS implementation.
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.
It seems that this API is essentially win.removeBrowserView(view) && win.addBrowserView(view)
?
I think we should probably allow moving browser view to arbitrary position, like |
Yes this was on my mind was well. Ultimately I went for the simplest possible solution, but am happy to entertain alternatives. My hesitation with arbitrary reordering is that I didn't want to take on any additional bookkeeping as I don't believe that the existing Do we think users would be confused that they can set the indexes, but |
I think if we allow reordering the views then we should make But yeah it requires additional bookkeeping so it might not really worth the efforts. Not sure how others in @electron/wg-api think. |
Bumped to |
Does the wg-api group meet regularly to consider questions like this? Just curious what the next steps are. Thanks! |
An alternative change that might provoke less anxiety would be to add a |
On the API itself, I prefer having APIs supporting arbitrary reordering, but I'm also OK with a simple |
electron#27007) * feat: Raise a browser view via `BrowserWindow.setTopBrowserView()`. This is similar to removing and re-adding a browser view, but avoids a visible flicker as the browser view is not removed from the window when using `setTopBrowserView`. Note: if the given browser view is not attached to the window, it will be added. This commit contains the macOS implementation. * feat: setTopBrowserView support for Windows and Linux * docs: add info about setTopBrowserView * docs: Clarify behavior when browserView is not yet attached. * fix: throw en error when browserView is not attached to the window * fix: build error * fix: test * fix: add test case * fix: tests * fix: reparenting * fix: close second window in tests Co-authored-by: sentialx <sentialx@gmail.com>
electron#27007) * feat: Raise a browser view via `BrowserWindow.setTopBrowserView()`. This is similar to removing and re-adding a browser view, but avoids a visible flicker as the browser view is not removed from the window when using `setTopBrowserView`. Note: if the given browser view is not attached to the window, it will be added. This commit contains the macOS implementation. * feat: setTopBrowserView support for Windows and Linux * docs: add info about setTopBrowserView * docs: Clarify behavior when browserView is not yet attached. * fix: throw en error when browserView is not attached to the window * fix: build error * fix: test * fix: add test case * fix: tests * fix: reparenting * fix: close second window in tests Co-authored-by: sentialx <sentialx@gmail.com>
electron#27007) * feat: Raise a browser view via `BrowserWindow.setTopBrowserView()`. This is similar to removing and re-adding a browser view, but avoids a visible flicker as the browser view is not removed from the window when using `setTopBrowserView`. Note: if the given browser view is not attached to the window, it will be added. This commit contains the macOS implementation. * feat: setTopBrowserView support for Windows and Linux * docs: add info about setTopBrowserView * docs: Clarify behavior when browserView is not yet attached. * fix: throw en error when browserView is not attached to the window * fix: build error * fix: test * fix: add test case * fix: tests * fix: reparenting * fix: close second window in tests Co-authored-by: sentialx <sentialx@gmail.com>
#27007) (#27712) * feat: Raise a browser view via `BrowserWindow.setTopBrowserView()`. This is similar to removing and re-adding a browser view, but avoids a visible flicker as the browser view is not removed from the window when using `setTopBrowserView`. Note: if the given browser view is not attached to the window, it will be added. This commit contains the macOS implementation. * feat: setTopBrowserView support for Windows and Linux * docs: add info about setTopBrowserView * docs: Clarify behavior when browserView is not yet attached. * fix: throw en error when browserView is not attached to the window * fix: build error * fix: test * fix: add test case * fix: tests * fix: reparenting * fix: close second window in tests Co-authored-by: sentialx <sentialx@gmail.com> Co-authored-by: Stewart Lord <stew@offbynone.com>
#27007) (#27713) * feat: Raise a browser view via `BrowserWindow.setTopBrowserView()`. This is similar to removing and re-adding a browser view, but avoids a visible flicker as the browser view is not removed from the window when using `setTopBrowserView`. Note: if the given browser view is not attached to the window, it will be added. This commit contains the macOS implementation. * feat: setTopBrowserView support for Windows and Linux * docs: add info about setTopBrowserView * docs: Clarify behavior when browserView is not yet attached. * fix: throw en error when browserView is not attached to the window * fix: build error * fix: test * fix: add test case * fix: tests * fix: reparenting * fix: close second window in tests Co-authored-by: sentialx <sentialx@gmail.com> Co-authored-by: Stewart Lord <stew@offbynone.com>
#27711) * feat: add `win.setTopBrowserView()` so that BrowserViews can be raised (#27007) * feat: Raise a browser view via `BrowserWindow.setTopBrowserView()`. This is similar to removing and re-adding a browser view, but avoids a visible flicker as the browser view is not removed from the window when using `setTopBrowserView`. Note: if the given browser view is not attached to the window, it will be added. This commit contains the macOS implementation. * feat: setTopBrowserView support for Windows and Linux * docs: add info about setTopBrowserView * docs: Clarify behavior when browserView is not yet attached. * fix: throw en error when browserView is not attached to the window * fix: build error * fix: test * fix: add test case * fix: tests * fix: reparenting * fix: close second window in tests Co-authored-by: sentialx <sentialx@gmail.com> * fix: build error Co-authored-by: Stewart Lord <stew@offbynone.com>
Description of Change
This PR adds win.setTopBrowserView() so that browser views can be raised without removing them and re-adding them to the window. Raising browser views is necessary to control which view receives pointer events when there are overlapping views. Removing and re-adding a view also works, but has the problem of introducing a noticeable flicker.
I'm unable to write a test for this because it does not appear possible to test which browser view receives pointer events.
Checklist
npm test
passesRelease Notes
Notes: Added
win.setTopBrowserView()
so that BrowserViews can be raised.