Repository navigation
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
42.3.3 (the relevant code is unchanged on main)
What operating system(s) are you using?
macOS
Operating System Version
macOS 26.4.1 (25E253)
What arch are you using?
arm64 (Apple Silicon)
Last Known Working Electron version
Unknown — the popup churn exists in all recent versions; it became user-visible on macOS 26, where window ordering waits on synchronous WindowServer transactions.
Expected Behavior
Typing into an <input> or <textarea> that has no datalist suggestions should not create or destroy native windows, and should not block the browser process.
Actual Behavior
Every keystroke that changes the value of a focused <input>/<textarea> (with the caret at the end) makes the renderer send ElectronAutofillDriver::ShowAutofillPopup with an empty suggestion list, and the browser process destroys and recreates a native autofill popup NSWindow each time. On macOS 26, each of those window-ordering operations blocks CrBrowserMain for 50–350 ms in a synchronous WindowServer transaction. Since CrBrowserMain routes all input events, every window and input of the app stutters.
CJK IME users are hit hardest: apps that type into a hidden textarea (e.g. xterm.js terminals) never change the textarea value for plain keys (keydown is preventDefault()ed), but IME preedit lives in the textarea and changes its value on every keystroke — so composition triggers the churn on every key. This was discovered while investigating Japanese-IME typing jank in Orca (an Electron-based terminal/agent app), where the jank affects the whole UI while composing.
Root cause chain (all verified):
-
Renderer —
AutofillAgent::ShowSuggestions(shell/renderer/electron_autofill_agent.cc) reachesShowPopup(element, {}, {})for any editable with a non-empty value and caret at end, even when there are zero datalist suggestions — including<textarea>, which can never have any.TextFieldValueChangedfires per keystroke (and percompositionupdateduring IME composition). -
Browser —
AutofillDriver::ShowAutofillPopup(shell/browser/electron_autofill_driver.cc) callsAutofillPopup::CreateView(shell/browser/ui/autofill_popup.cc), which unconditionallyHide()s the previous popup and creates + shows a new native child window — even for an empty list. Net effect: one NSWindow destroy + create + order-in per keystroke. -
macOS 26 —
sample(1)of the browser process during typing showsCrBrowserMainblocked in:-[NSWindow _doOrderWindow:] -[NSCGSWindow(NSCGSWindowOrdering) isOrderedIn] SLSWindowIsOrderedIn (SkyLight) SLSConnectionSynchronizeSLSCATransaction _SLSTransactionWaitSource → mach_msg2_trap ← 1961 of 2006 samples
Evidence from a real 90 s Japanese-typing session in Orca (devtools.timeline + toplevel + latencyInfo trace): 74 Receive mojo message tasks ≥ 30 ms tagged electron.mojom.ElectronAutofillDriver on CrBrowserMain, totalling 10.1 s with a 263 ms max; 15 of 23 keydowns with > 100 ms InputLatency::RawKeyDown overlapped one of those tasks. Renderer-side handlers took 1–2 ms — the latency is entirely browser-process dispatch delay.
Testcase Gist URL
Additional Information
The testcase needs no IME: it synthesizes composition updates via webContents.debugger (Input.imeSetComposition) into a plain autofocused <textarea>, and measures browser-process main-thread stalls with a 16 ms timer-drift monitor (the Node event loop shares CrBrowserMain, so synchronous WindowServer waits appear as timer drift).
Results on macOS 26.4.1 / Electron 42.3.3 / M-series:
# textarea focused (autofill popup churn):
50 synthetic IME composition updates in 6957 ms
main-process event-loop stalls >50ms: count=37 total=4915 ms max=350 ms
# CONTROL=1 (textarea blurred, no editable target → no autofill traffic):
50 synthetic IME composition updates in 5220 ms
main-process event-loop stalls >50ms: count=1 total=118 ms max=118 ms
Manual repro: run the same app and type into the textarea with a Japanese/Chinese/Korean IME — the Event Timing API logs keydown durations in the hundreds of ms.
The same measurement against VS Code 1.125.1 (Electron 42.2.0) on the same machine reproduces identically — VS Code ships the same code and is not immune: 25 synthetic composition updates into its integrated terminal (a real xterm.js helper textarea) produced 26 ElectronAutofillDriver tasks totalling 1081 ms (max 163 ms) on CrBrowserMain; a plain <input> in its workbench produced 333 ms. VS Code's editor escapes only because Monaco keeps the caret mid-value in its hidden textarea, which fails the requires_caret_at_end check.
Causality was also confirmed in-app with the caret condition alone: keeping a zero-width sentinel after the caret during composition (so SelectionEnd() != value.length()) drops the same 25-keystroke workload from 1208 ms to 0 ms of browser-main blocking — the messages still flow, but the cheap HideAutofillPopup path replaces the popup-window rebuild.
Why editors like VS Code (Monaco) escape this: Monaco keeps surrounding context in its hidden textarea with the caret mid-value, so the requires_caret_at_end check in ShowSuggestions fails and only the cheap HidePopup path runs. xterm.js keeps the caret at the end of the preedit, hitting the expensive path on every composition update.
Proposed fix — mirror Chromium and only show the popup when there are suggestions:
// shell/renderer/electron_autofill_agent.cc, AutofillAgent::ShowSuggestions
std::vector<std::u16string> data_list_values;
std::vector<std::u16string> data_list_labels;
if (!input_element.IsNull()) {
GetDataListSuggestions(input_element, &data_list_values, &data_list_labels);
}
if (data_list_values.empty()) {
HidePopup();
return;
}
ShowPopup(element, data_list_values, data_list_labels);AutofillPopup::Hide() is already a no-op when nothing is showing, so the steady-state cost for suggestion-less fields becomes zero. A belt-and-suspenders guard in AutofillDriver::ShowAutofillPopup (if (values.empty()) { autofill_popup_->Hide(); return; }) would additionally protect against compromised renderers.
This is likely a meaningful contributor to the broader "Electron apps feel sluggish on macOS 26" class of reports (e.g. #48311 discusses SLS transaction sensitivity): the per-keystroke popup churn predates Tahoe but used to be cheap; Tahoe's synchronous WindowServer transactions turned it into user-visible input latency. Full sample(1) output and the 90 s trace are retained and can be shared on request.
Activity
hirorocky commentedon Jul 4, 2026
Corroborating evidence from the archives: #26667 (2020) is a debug-build DCHECK crash —
Check failed: !clamped_content_size.IsEmpty(). Zero-sized windows not supported on Mac— with exactly this call stack (ElectronAutofillDriverStubDispatch::Accept→AutofillDriver::ShowAutofillPopup→AutofillPopup::CreateView→AutofillPopupView::Show→SetBounds), observed while running Slack. That is the empty-suggestion popup described here being created with zero size: debug builds have been asserting on this exact misbehavior since at least 2020, release builds just silently paid for the window churn — until macOS 26 made each one cost 100+ ms. The proposed fix (skipShowPopupwhen there are no datalist suggestions) would also resolve that six-year-old DCHECK.nikwen commentedon Jul 4, 2026
Thanks for reporting!
Does this window recreation also happen in Chrome?
hirorocky commentedon Jul 6, 2026
No — I ran the identical workload against Chrome on the same machine (Chrome 149.0.7827.199, macOS 26.4.1, arm64), driving 50 synthetic composition updates via CDP (
Input.imeSetComposition, 120 ms apart) into the same test page:The Event Timing API in the page shows every composition event completing in 16–24 ms with 0 ms input delay — Chrome stays perfectly smooth on the same macOS build.
The reason is architectural: Chromium's renderer-side agent queries the browser (
AskForValuesToFill) instead of pushing a show command, and the browser only creates/shows the popup when it actually has suggestions. With zero suggestions it explicitly hides instead —AutofillExternalDelegate::OnSuggestionsReturnedincomponents/autofill/core/browser/ui/autofill_external_delegate.cc:So the autofill IPC traffic per keystroke exists in Chrome too (as the message counts above show), but it never turns into native window creation/destruction. Electron's
AutofillAgent::ShowSuggestionsis the divergence: it reachesShowPopup(element, {}, {})with an empty datalist, andAutofillPopup::CreateViewthen rebuilds the native window unconditionally. That is what the proposed fix aligns with Chromium's behavior.