From 9530f3e9575b57a0083370de86c56bc531ad9a1f Mon Sep 17 00:00:00 2001 From: Ruslan Date: Wed, 13 May 2026 12:14:44 +0000 Subject: [PATCH] fix: autofill dispatches focus/blur/keyup/InputEvent for SPA frameworks --- universal-runtime/manager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/universal-runtime/manager.py b/universal-runtime/manager.py index d7081c3..b0194d2 100644 --- a/universal-runtime/manager.py +++ b/universal-runtime/manager.py @@ -100,12 +100,15 @@ _AUTOFILL_CONTENT_JS = r""" function setNativeValue(el, v) { if (!el) return false; if (el.value === v) return true; + el.dispatchEvent(new FocusEvent('focus', { bubbles: true })); const proto = Object.getPrototypeOf(el); const desc = Object.getOwnPropertyDescriptor(proto, 'value') || Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value'); if (desc && desc.set) desc.set.call(el, v); else el.value = v; - el.dispatchEvent(new Event('input', { bubbles: true })); + el.dispatchEvent(new InputEvent('input', { bubbles: true, data: v, inputType: 'insertText' })); el.dispatchEvent(new Event('change', { bubbles: true })); + el.dispatchEvent(new KeyboardEvent('keyup', { bubbles: true, key: v.slice(-1) })); + el.dispatchEvent(new FocusEvent('blur', { bubbles: true })); return true; }