From 4cad34509f6d5bcdf4bec9df20bf5f75b56ffe6a Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Wed, 3 Feb 2021 08:47:52 -0800 Subject: [PATCH] fix(oopifs): do not emulate focus in oopifs (#5270) - We don't need this, since it should propagate from the main frame. - Forcing focus in oopif immediately focuses it and blurs currently focused frame. This leads to undesired side effects, e.g. selects being closed. --- src/server/chromium/crPage.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/chromium/crPage.ts b/src/server/chromium/crPage.ts index eebdbdb4a6..1387069e90 100644 --- a/src/server/chromium/crPage.ts +++ b/src/server/chromium/crPage.ts @@ -445,8 +445,9 @@ class FrameSession { }), this._networkManager.initialize(), this._client.send('Target.setAutoAttach', { autoAttach: true, waitForDebuggerOnStart: true, flatten: true }), - this._client.send('Emulation.setFocusEmulationEnabled', { enabled: true }), ]; + if (this._isMainFrame()) + promises.push(this._client.send('Emulation.setFocusEmulationEnabled', { enabled: true })); const options = this._crPage._browserContext._options; if (options.bypassCSP) promises.push(this._client.send('Page.setBypassCSP', { enabled: true }));