fix(studio): respect composition and cancellation in text inputs by shuaiyafei · Pull Request #6011 · heygen-com/hyperframes · GitHub
Skip to content

fix(studio): respect composition and cancellation in text inputs - #6011

Open
shuaiyafei wants to merge 1 commit into
heygen-com:mainfrom
shuaiyafei:fix/text-input-ime-composition
Open

shuaiyafei wants to merge 1 commit into
heygen-com:mainfrom
shuaiyafei:fix/text-input-ime-composition

Conversation

@shuaiyafei

Copy link
Copy Markdown

What

Let the shared Input finish an IME composition without treating its Enter/Escape keys as editor commands. Finalize a draft once: Enter followed by blur commits once, and Escape followed by blur commits nothing.

Why

The keyboard handler currently intercepts composing key events. Separately, Enter or Escape clears the dirty flag, but blur still commits the captured draft unconditionally. A focused Escape therefore writes the value it just discarded; Enter can notify the caller and tracking callback twice while the parent is still persisting the value.

Related work

Self-contained correction to the shared text Input. #5947 changes NumberField bounds and #4710 changes Select; they also use valueControls.test.tsx.

How

Return early for composing key events and let blur commit only a dirty draft. This uses the field's existing draft lifecycle and dirty flag.

Before

Before: duplicate and cancelled commits, and intercepted composition keys

After

After: one Enter commit, no cancelled commit, and composition keys left alone

These captures render the actual React component in Chromium. Each row records a fresh-page keyboard sequence; composition events are dispatched explicitly, not generated by an operating-system IME.

Test plan

  • Four regression cases fail on unchanged source: composing Enter/Escape, Enter then blur, and Escape then blur.

  • The value-control file now passes 20 tests, including ordinary blur as a positive control. The UI directory passes 68 tests.

  • Browser assertions reproduce all four failures on the upstream component and pass with the patch, checking committed values, raw tracking-call counts, and whether the key was prevented.

  • Workspace build, updated Studio build, oxlint/oxfmt, and the full pre-commit and commit-msg hooks passed.

  • Unit tests added

  • Browser reproduction performed, with before/after captures

  • Comment rules reviewed

AI assistance: Codex.

This branch has not been deployed

No deployments
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.

1 participant