thomasbachem

#55667: docs: remove outdated focus note from webContents.sendInputEvent()

Merged
Created: Nov 8, 2026, 2:52:40 PM
Merged: Nov 9, 2026, 2:27:01 PM
6 comments
Target: main

Description of Change

The note under sendInputEvent() says the window needs to be focused for it to work. It came from #8299 in 2016, where a shown window on Ubuntu got no char events while another window had focus. That no longer holds, and the sendInputEvent(event) specs already send key events to a show: false window that never gets focus.

I checked windows without focus on macOS, Windows and Linux with Electron 45.2.3: never shown, shown behind another focused window, shown with showInactive(), hidden after show(), and minimized. In all of them, typing into an <input> and clicking a button through sendInputEvent() worked as in a focused window, with trusted keydown, input and click events. Meanwhile win.isFocused() and document.hasFocus() both returned false. On Linux this ran under Xvfb with openbox. The probe and its results are in this run.

Disclosure: I developed this with Claude (Claude Code), and reviewed and verified it.

Checklist

Release Notes

Notes: none

Backports

45-x-y
Merged
PR Number
#55689
Merged At
Nov 9, 2026, 3:33:56 PM
Released In
Not yet
Release Date
Not yet
46-x-y
Merged
PR Number
#55688
Merged At
Nov 9, 2026, 3:36:05 PM
Released In
Not yet
Release Date
Not yet

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron