Skip to content

fix(ui): preserve accents and quotes when typing starts outside composer - #138274

Closed
vyctorbrzezowski wants to merge 1 commit into
mainfrom
fix/control-ui-composer-dead-keys
Closed

vyctorbrzezowski wants to merge 1 commit into
mainfrom
fix/control-ui-composer-dead-keys

Conversation

@vyctorbrzezowski

@vyctorbrzezowski vyctorbrzezowski commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Closes #138273

What Problem This Solves

Control UI users can lose a dead-key accent or quotation mark when typing starts outside the Chat or New Session composer. The initial dead key reaches the page before the textarea receives focus.

Reported by @mcaxtr.

User Impact

Dead keys now transfer focus to the composer before subsequent text input. Chat and New Session use the same rule, while focused inputs, active composition, shortcuts, menus, and modal dialogs retain their existing exclusions.

Why This Change Was Made

The shared focus-transfer owner recognizes Dead, including its Alt-modified form, as an input-producing key. It focuses the textarea during keydown without preventing the browser default or inserting characters manually. Production changes remain limited to the existing guard and its comment (+4/-4).

Evidence

Rebased without conflicts onto bf3d877829d005bcd1e144e5f84d19983c4b9a7a. The patch is unchanged by the rebase. Rebased head: 8a7efde47e261462a6d6fd9910b680d36b5528b8.

Validation of the unchanged rebased source tree on Linux:

  • node scripts/run-vitest.mjs ui/src/pages/chat/chat-pane-keyboard-focus.test.ts ui/src/e2e/chat-composer-focus.e2e.test.ts: 52 unit tests and 7 browser tests passed.
  • The browser regression sends a trusted Dead event through Chromium's debugging protocol, asserts focus transfer in Chat and New Session, then verifies accented text and quotes. It also checks the exact chat.send message from Chat.
  • node scripts/ui.js build: passed after restoring the frozen dependencies.
  • node --import ./scripts/tsx.mjs scripts/check-control-ui-performance.mts: passed. Startup JavaScript is 355,213 B gzip against a 355,719 B limit; startup CSS is 46,081 B against a 51,200 B hard limit. CSS is 1 B above the advisory target.
  • node scripts/check-changed.mjs --timed -- ui/src/e2e/chat-composer-focus.e2e.test.ts ui/src/pages/chat/chat-pane-keyboard-focus.test.ts ui/src/pages/chat/chat-pane-shared.ts: passed with exit 0.
  • git diff --check: passed.

The original regression was reported on v2026.9.1 and then-current main. Current main still returns before focus transfer for Dead because it rejects Alt-modified keys and keys whose names are longer than one character.

Risk and coverage

The browser tests cover both consumers, menu and activation-key ownership, typing from the context menu, remote-control input exclusion, first-character preservation, and focus styling. The unit tests also verify that focus transfer does not prevent the browser default and that modal dialogs keep ownership.

The dead-key browser test proves focus transfer followed by preservation of completed text. It does not reproduce native keyboard-layout composition: Playwright inserts non-US-layout characters directly. Native macOS and Windows layout checks, including dead key plus base letter and dead key plus Space, remain unverified.

Matched before/after captures remain pending. The earlier screenshots used different fixtures and viewports, and the desktop after capture included the community invitation card; they are not presented here as equivalent visual proof. No new screenshots were captured during this rebase.

@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vyctorbrzezowski
vyctorbrzezowski marked this pull request as ready for review September 4, 2026 13:15
@vyctorbrzezowski vyctorbrzezowski self-assigned this Sep 4, 2026
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 13, 2026, 1:48 AM ET / 05:48 UTC (Revision 4).

ClawSweeper review

What this changes

The PR lets dead keys move focus into the Chat and New Session composers and adds coverage for preserving accented text and quotes.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains a useful, focused fix: current main and the latest release still reject dead keys before transferring focus. No introduced correctness defect was found, and the related merged menu refactor explicitly leaves this work separate.

Priority: P2
Reviewed head: 8a7efde47e261462a6d6fd9910b680d36b5528b8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful browser-boundary coverage and no concrete correctness finding; native composition coverage remains limited.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Reported Chromium coverage exercises the production focus handler in both composers and Chat submission, while native layout composition remains explicitly unverified.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Reported Chromium coverage exercises the production focus handler in both composers and Chat submission, while native layout composition remains explicitly unverified.
Evidence reviewed 7 items Pinned production change: The complete introduced diff changes the existing guard to accept Dead, including Alt-modified Dead. Ctrl/Meta, active composition, interactive targets, modal layers, disabled composers, and read-only composers retain their exclusions; character insertion remains browser-owned.
Current main still needs the repair: The fetched main implementation still returns for event.altKey and event.key.length !== 1, excluding Dead before composer.focus. Both Chat and New Session consume this shared handler.
Latest release retains the restrictive guard: The source at the supplied v2026.9.4 release commit also rejects Alt-modified keys and multi-character key names; this fix is not present there.
Findings None None.
Security None None.

How this fits together

The Control UI routes page-level typing into the active message composer unless another control owns the key. This shared handler transfers focus, then leaves character insertion and composition to the browser.

flowchart TD
  A[Page keyboard input] --> B[Shared focus handler]
  B --> C{Another control owns input?}
  C -->|Yes| D[Keep existing focus]
  C -->|No, printable or dead key| E[Focus active composer]
  E --> F[Browser text composition]
  F --> G[Message draft]
Loading

Before merge

  • Resolve merge risk (P1) - Native keyboard-layout composition remains unverified: the browser regression inserts completed characters after focus transfer rather than exercising dead key plus base letter or Space.
Agent review details

Security

None.

PR surface

Source 0, Tests +65. Total +65 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 4 4 0
Tests 2 69 4 +65
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 73 8 +65

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep one shared focus-transfer rule for both composers and preserve the browser's native composition pipeline without manually inserting characters.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep one shared focus-transfer rule for both composers and preserve the browser's native composition pipeline without manually inserting characters.

Do we have a high-confidence way to reproduce the issue?

Yes, for the focus-transfer defect: current main necessarily rejects Dead before focusing the textarea. Native accent composition itself was not reproduced in this review.

Is this the best way to solve the issue?

Yes. Extending the existing shared guard is a narrow repair that preserves browser input handling and avoids separate Chat and New Session implementations.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4f545c0dbf14.

Labels

Label justifications:

  • P2: This is a bounded composer-input repair for users who begin dead-key typing outside the textarea.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Reported Chromium coverage exercises the production focus handler in both composers and Chat submission, while native layout composition remains explicitly unverified.

Evidence

What I checked:

  • Pinned production change: The complete introduced diff changes the existing guard to accept Dead, including Alt-modified Dead. Ctrl/Meta, active composition, interactive targets, modal layers, disabled composers, and read-only composers retain their exclusions; character insertion remains browser-owned. (ui/src/pages/chat/chat-pane-shared.ts:273, 8a7efde47e26)
  • Current main still needs the repair: The fetched main implementation still returns for event.altKey and event.key.length !== 1, excluding Dead before composer.focus. Both Chat and New Session consume this shared handler. (ui/src/pages/chat/chat-pane-shared.ts:273, 4f545c0dbf14)
  • Latest release retains the restrictive guard: The source at the supplied v2026.9.4 release commit also rejects Alt-modified keys and multi-character key names; this fix is not present there. (ui/src/pages/chat/chat-pane-shared.ts, 3a9d69db306c)
  • Browser coverage and its limits: The added Chromium scenario dispatches Dead through CDP, asserts focus in both composers, then inserts completed text and checks Chat's outgoing message. The captured PR body reports 52 unit and 7 browser cases passing and explicitly disclaims native keyboard-layout composition. Its supplied sourceRevision is dc754554c30f11ca66c00ee9ade36517d2dbd7a5637dd6fa89a7886e4ef15890. No tests were executed during this read-only review. (ui/src/e2e/chat-composer-focus.e2e.test.ts:161, 8a7efde47e26)
  • Discussion supports the owner-level repair: The live review by sylvesterkaczmarek supports transferring focus during Dead keydown without preventing browser input. The paired report remains open at [Bug]: Control UI drops dead-key accents and quotes when typing outside the composer #138273. The merged refactor(ui): share composer suggestion menu behavior #140633 explicitly states that the dead-key focus owner is untouched.
  • Prior merged work supplies routing context: Current-main history includes the earlier New Session typing repair. GitHub commit metadata identifies vyctorbrzezowski and shows the shared focus handler and New Session caller changes. Local deep history inspection encountered unavailable blobs and HTTP 403; the earlier reviewed head was unavailable, so patch-identical rebase continuity was not independently established. (ui/src/pages/chat/chat-pane-shared.ts:273, 57c752a46c04)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • sylvesterkaczmarek: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Strengthen confidence with redacted native-layout observations for dead key plus base letter and dead key plus Space when typing begins outside each composer.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-04T13:36:05.674Z sha f7a56f9 :: blocked before merge. :: none
  • reviewed 2026-09-04T14:38:57.826Z sha f7a56f9 :: blocked before merge. :: none
  • reviewed 2026-09-07T18:43:46.105Z sha 8a84abb :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 4, 2026

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Treating Dead as an input-producing key without preventing the event is exactly what this focus-transfer owner needs. The bug is not composition itself; it is that the browser receives the dead key before the textarea owns focus. Moving focus during keydown preserves the native composition pipeline while retaining the existing Ctrl/Meta, modal, dropdown and active-IME exclusions. Covering both Chat and New Session is important because they share this owner and could otherwise drift.

@vyctorbrzezowski
vyctorbrzezowski force-pushed the fix/control-ui-composer-dead-keys branch from f7a56f9 to 8a84abb Compare September 7, 2026 18:37
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. and removed P1 High-priority user-facing bug, regression, or broken workflow. labels Sep 7, 2026
@vyctorbrzezowski
vyctorbrzezowski force-pushed the fix/control-ui-composer-dead-keys branch from 8a84abb to 8a7efde Compare September 13, 2026 05:42
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Closing: the dead-key composer fix needs native keyboard proof that we cannot produce in the current harness, and the issue is not reproducible on current main in the mocked flow. Will reopen with a native reproduction if it resurfaces.

@RomneyDa
RomneyDa deleted the fix/control-ui-composer-dead-keys branch October 22, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Control UI drops dead-key accents and quotes when typing outside the composer

2 participants