Skip to content

fix(agents-server-ui): mobile composer submit (Send button + soft-keyboard Enter)#4402

Merged
icehaunter merged 1 commit into
electric-sql:mainfrom
nharsch:fix/agent-ui-mobile-submit
May 25, 2026
Merged

fix(agents-server-ui): mobile composer submit (Send button + soft-keyboard Enter)#4402
icehaunter merged 1 commit into
electric-sql:mainfrom
nharsch:fix/agent-ui-mobile-submit

Conversation

@nharsch
Copy link
Copy Markdown
Contributor

@nharsch nharsch commented May 22, 2026

Fixes #4401.

Problem

The agent UI composer at /__agent_ui/ silently dropped message submissions on mobile browsers — both Send button taps and virtual-keyboard Enter were non-functional. The textarea accepted text but nothing was ever sent.

Two distinct root causes, both in packages/agents-server-ui/src/components/MessageInput.tsx:

Send button. Tapping the button blurred the textarea, the on-screen keyboard began dismissing, and the viewport reflowed between pointerdown and pointerup. The resulting click landed off the button and the send never fired.

Virtual-keyboard Enter. The keydown handler only matched e.key === 'Enter', but Android Chrome / GBoard frequently report key === 'Unidentified' / keyCode === 229 (IME-coordinated path) or route the return key through beforeinput as insertLineBreak with no matching keydown at all.

Fix

  • enterKeyHint="send" on the textarea so soft keyboards surface a send-shaped action key and (critically on Android Chrome) fire keydown with key === 'Enter' reliably.
  • IME guard in the keydown handler — skip submit while e.nativeEvent.isComposing is true, and explicitly skip e.keyCode === 229 (Android Chrome doesn't always set isComposing).
  • onBeforeInput fallback matching inputType === 'insertLineBreak' for soft keyboards that route the return key through beforeinput without a matching keydown.
  • onPointerDown preventDefault for non-mouse pointers on the Send button — keeps focus on the textarea so the on-screen keyboard doesn't dismiss, the viewport doesn't reflow between pointerdown and pointerup, and the resulting click lands on the button as intended. Mouse pointers are excluded so desktop click behaviour is unchanged.

Tested on

  • ✅ Android Chrome — Send button and virtual-keyboard Enter both submit
  • ✅ iOS Chrome — same
  • ✅ Desktop (Linux Chrome) — Enter and click still work; no regressions

Verified locally against the bundled UI in electricax/agents-server:latest with packages/agents-server-ui/dist volume-mounted in.

Changeset

A patch-level @electric-ax/agents-server-ui changeset is included (.changeset/agent-ui-mobile-submit.md).

…board Enter)

The Agent UI composer at /__agent_ui/ couldn't submit messages from
mobile browsers (Android Chrome and iOS Chrome). Two distinct
root causes, both fixed in MessageInput.tsx:

Send button — tapping it blurred the textarea, the on-screen keyboard
began dismissing, the viewport reflowed between pointerdown and
pointerup, and the resulting click landed off the button. Fixed by
preventDefault on pointerdown for non-mouse pointers so focus stays
in the textarea; the click still dispatches normally.

Soft-keyboard Enter — the keydown handler only matched
`key === 'Enter'`, but Android Chrome / GBoard frequently report
`key === 'Unidentified'` / `keyCode === 229` or route the return key
through `beforeinput` as `insertLineBreak` with no matching `keydown`.
Added `enterKeyHint="send"` so the keyboard surfaces a send-shaped
action key and fires `keydown` reliably, an IME guard
(`isComposing` / `keyCode === 229`) so committing IME candidates
doesn't trigger a send, and a `beforeinput` fallback that submits on
`insertLineBreak`.

Fixes electric-sql#4401.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@icehaunter icehaunter merged commit b39f581 into electric-sql:main May 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent UI: message submit broken on mobile browsers (Send button and Enter both non-functional)

2 participants