Skip to content

Chips: ignore Enter and Escape during an IME composition - #43269

Closed
b84330808 wants to merge 1 commit into
twbs:mainfrom
b84330808:chips-ime-composition
Closed

b84330808 wants to merge 1 commit into
twbs:mainfrom
b84330808:chips-ime-composition

Conversation

@b84330808

Copy link
Copy Markdown

Description

  • _handleInputKeydown() now returns early when the keydown belongs to an IME composition: event.isComposing is true, or keyCode is 229.
  • Safari sends the Enter that commits the text after compositionend, with keyCode 229. The second check covers it.
  • Two tests in js/tests/unit/chips.spec.js dispatch these keydowns. Before the fix they fail with expected [ 'とうきょう' ] to deeply equal [] and expected '' to deeply equal 'とうきょう'. After the fix the chips spec passes.

Motivation & Context

  • Chinese, Japanese and Korean users type through an input method. Enter commits the composed text, and Escape cancels it.
  • The chips input treats both keys as its own shortcuts. Enter creates a chip from the uncommitted text, for example とうきょう before conversion to 東京. Escape clears the whole input.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

  • Not applicable, JavaScript only.

Related issues

  • None found.

I used Claude Code to write this change.

With a Chinese, Japanese or Korean input method, the Enter that commits
the composed text also created a chip from the uncommitted text, and the
Escape that cancels the composition cleared the whole input. The input
keydown handler now returns early when the keydown belongs to a
composition: `isComposing` is true, or keyCode is 229 (Safari sends the
committing keydown after `compositionend`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@b84330808
b84330808 requested a review from a team as a code owner November 2, 2026 15:03
@julien-deramond julien-deramond added v6 v6, the main branch bug Something does not work as documented js JavaScript or TypeScript sources and plugins labels Nov 2, 2026
@mdo mdo closed this in #43300 Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something does not work as documented js JavaScript or TypeScript sources and plugins v6 v6, the main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants