Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Adding characters before the cursor while composing with IME results in offset of characters from IME #1472

Closed

Description

@mikecat

Describe the issue

  1. start composing with an IME on some position
  2. add some characters before the cursor
  3. hit Enter key to have the IME insert composed characters

As a result, the inserted characters appear before where they are expected.
They looks like being inserted using the original number of characters from the beginning of the document, regardless of the inserted characters.
This may result in some trouble in, for example, a collaborative editor application where multiple users concurrently write something.

This happened with Google Chrome 131.0.6778.70 and Microsoft Edge 131.0.2903.48, with Google 日本語入力 and Microsoft IME.

This is an example with Google Chrome:

2024-11-15.085747.mp4

On the other hand, this didn't happen on Firefox 132.0.2:

2024-11-15.085641.mp4

Browser and platform

Google Chrome, Microsoft Edge

Reproduction link

https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgoKY29uc3QgdmlldyA9IG5ldyBFZGl0b3JWaWV3KHsKICBkb2M6ICJ0ZXN0XG5cbmhvZ2VcbiIsCiAgZXh0ZW5zaW9uczogW2Jhc2ljU2V0dXBdLAogIHBhcmVudDogZG9jdW1lbnQuYm9keQp9KQoKc2V0SW50ZXJ2YWwoKCkgPT4gewogIHZpZXcuZGlzcGF0Y2goe2NoYW5nZXM6IHtmcm9tOiAwLCBpbnNlcnQ6ICJ0In19KTsKfSwgNTAwMCk7Cg==

Activity

  1. marijnh commented on Nov 15, 2024

    @marijnh
    Member

    It seems I was expecting too much from Chrome's EditContext implementation. I've opened an issue about it, but that will probably not get addressed all that quickly. So I'm going to see if I can work around this in the library for the time being.

  2. marijnh commented on Nov 15, 2024

    @marijnh
    Member

    Attached patch kludges around this until this is handled better on the browser's side.

    See also w3c/edit-context#111

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