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; }