Skip to content

WebView elements don't see change when navigating away. focusout event not sent. #253146

@Colengms

Description

@Colengms

Does this issue occur when all extensions are disabled?: No, it involves extension APIs.

Version: 1.101.2 (system setup)
Commit: 2901c5a
Date: 2025-06-24T20:27:15.391Z
Electron: 35.5.1
ElectronBuildId: 11727614
Chromium: 134.0.6998.205
Node.js: 22.15.1
V8: 13.4.114.21-electron.0
OS: Windows_NT x64 10.0.26100

We're using a WebView for extension configuration. We have some "change" events plumbed up to intercept settings changes and apply them.

        elements.forEach(el => {
            el.addEventListener("change", this.onChanged.bind(this, el.id));
        });

If the user has the WebView 'document' open with the text focus still within a modified text field, and they click somewhere else or on another app, the change is correctly processed. However, if they navigate to another document (with focus still in modified text field) such that the WebView document becomes immediately not-visible (now behind the other document), the lose of focus is NOT processed and the text modification the user made is lost.

Hooking up a focusout event:

        document.addEventListener('focusout', (event) => {
            console.log(`Focusout event`);
        });

I can see that this is never generated in the repro scenario.

Repro video:

Recording.2025-05-23.170653.mp4

My guess is that because the WebView is becoming no longer visible, there is a higher-level deactivation that is occurring that is not allowing the WebView to properly process loss of focus.

C/C++ Extension repro: microsoft/vscode-cpptools#13636

Metadata

Metadata

Assignees

Labels

*as-designedDescribed behavior is as designed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions