Thinkmill / Thinkmill/keystatic

Japanese IME composition is broken on the first character in an empty Markdoc field

Open
#1,616 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.4k
Forks
159
Avg merge
21h 41m
Merged PRs (30d)
2

Description

Japanese IME composition is broken on the first character in the rich text editor

Image

Japanese IME input is broken when typing the first character into an empty Keystatic rich text editor.

This is not specific to fields.markdoc(), fields.mdx(), or entryLayout: "content".

I can reproduce the same behavior across the rich text editor itself.

For example, when trying to type:

にほんご

the editor produces:

nいほんご

The first n is committed separately instead of being included in the IME composition.

Steps to reproduce

  1. Open an entry containing a Keystatic rich text field.
  2. Focus an empty editor.
  3. Enable a Japanese IME.
  4. Type nihongo.

Expected:

にほんご

Actual:

nいほんご

Browser behavior

I can reproduce this in both:

  • Google Chrome
  • Mozilla Firefox

Additional findings

The issue is reproducible with different rich text field types, including:

  • fields.markdoc()
  • fields.mdx()

It also occurs regardless of whether entryLayout: "content" is used.

Because of this, the problem appears to be in the shared rich text editor implementation rather than in Markdoc, MDX, or the collection layout.

The problem seems to occur specifically when typing the first character into an empty editor.

Once the editor already contains text, Japanese IME input works normally.

Suspected behavior

It looks like the IME composition is interrupted immediately after the first romaji character is entered.

For example, while trying to type:

nihongo

the first:

n

is committed separately, and the remaining:

ihongo

continues as a new IME composition.

This suggests that the editor may be changing the DOM, selection, or editor state while the initial IME composition is active.

Additional information

I have a GIF showing the issue clearly and can attach it to this issue.

The issue is reproducible with Japanese IME input in both Chrome and Firefox.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shared rich text editor implementation, since the issue reproduces across Markdoc and MDX fields and entry layouts. Reproduce the first-character Japanese IME case in Chrome or Firefox, then verify that typing nihongo into an empty editor produces にほんご without interrupting composition.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.