Skip to content

[Bug] IME confirmation Enter commits the session rename (and project alias / extension input) mid-composition #516

Closed

Description

@kojilab-dev

Describe the bug
When renaming a session from the sidebar (… → Rename) with a Japanese IME, the Enter key that confirms the IME conversion also commits the rename. The name is saved half-typed, so the user cannot finish typing it. Chinese and Korean IME users hit the same problem.

In IME input, Enter confirms the current conversion candidate. That keystroke still reaches the page as a keydown with key === "Enter"; the only difference is event.isComposing === true and keyCode === 229. The rename input checks only event.key === "Enter":

// components/SessionSidebar-rows.tsx:906 (main @ e99dac0)
onKeyDown={(event) => { if (event.key === "Enter") void commitRename(); ... }}

The same pattern exists in two other inputs:

  • Project alias input: components/SessionSidebar-rows.tsx:284
  • Extension input dialog: components/ExtensionDialog.tsx:773 (if (e.key === "Enter") submitValue();)

Safari note
isComposing alone is not enough on macOS Safari: WebKit delivers compositionend to script before the confirming Enter keydown, so isComposing is already false when the handler runs (WebKit bug 165004: https://bugs.webkit.org/show_bug.cgi?id=165004 ). Checking keyCode === 229 as well covers it.

Suggested fix
ChatInput.tsx already handles this correctly (lines 1998–2004: isComposingRef / nativeEvent.isComposing / keyCode === 229 plus the 100 ms COMPOSITION_END_ENTER_GRACE_MS window after compositionend). Extracting that into a shared helper and using it in the three handlers above would fix it, for example:

function isImeEnter(e: React.KeyboardEvent) {
  return e.nativeEvent.isComposing || e.nativeEvent.keyCode === 229;
}

onKeyDown={(event) => {
  if (event.key === "Enter") {
    if (isImeEnter(event)) return;
    event.preventDefault();
    void commitRename();
  }
  ...
}}

Chrome's guide on this pattern explicitly lists inline rename fields and modal dialog inputs as affected: https://developer.chrome.com/docs/modern-web-guidance/guides/forms/ime-safe-enter-submit

To reproduce

  1. Switch the OS input source to Japanese (e.g. macOS Japanese – Romaji).
  2. In the session sidebar, click … on a session → Rename.
  3. Type てすと, press Space to convert to テスト, then press Enter to confirm the conversion.
  4. The rename is committed immediately, before the user has finished typing.

Expected behavior
The first Enter only confirms the IME conversion. The rename is committed by the next Enter pressed outside composition (or on blur).

Environment

  • OS: macOS
  • omp version: 18.12.3
  • omp-web version: 0.6.0 (installed); the same code is still on main at e99dac0 (0.7.1)

Additional context
Reported by a Japanese user. This is a common issue in UIs built and tested with English input only, because English typing never enters composition.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions