fix: setTopBrowserView focus issue with reordering (#42653)
* fix: reorder top browser view instead of adding/removing * fix: update browserViews order * test: add a test for setTopBrowserView
This commit is contained in:
parent
efff369639
commit
e9a93a8c5c
2 changed files with 19 additions and 1 deletions
|
@ -232,7 +232,12 @@ BrowserWindow.prototype.getBrowserViews = function () {
|
|||
|
||||
BrowserWindow.prototype.setTopBrowserView = function (browserView: BrowserView) {
|
||||
if (browserView.ownerWindow !== this) { throw new Error('Given BrowserView is not attached to the window'); }
|
||||
this.addBrowserView(browserView);
|
||||
const idx = this._browserViews.indexOf(browserView);
|
||||
if (idx >= 0) {
|
||||
this.contentView.addChildView(browserView.webContentsView);
|
||||
this._browserViews.splice(idx, 1);
|
||||
this._browserViews.push(browserView);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = BrowserWindow;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue