Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Enter" key behavior is strange with IME on Chrome #206

Closed
azu opened this issue Jun 6, 2020 · 7 comments
Closed

"Enter" key behavior is strange with IME on Chrome #206

azu opened this issue Jun 6, 2020 · 7 comments

Comments

@azu
Copy link

azu commented Jun 6, 2020

I've enter following text with Google IME(Input method) on https://codemirror.net/6/ and I get wrong <NewLine> result.

NIHONGO<Space><Enter>

📝 Press <Space><Enter> to select the highlighted candidate and inputed 日本語 as results(日本語 === NIHONGO)

Expected result:

日本語|<Cursor is here>

Actual result:

<NewLine>
日本語|<Cursor is here>

GIF:

Jun-07-2020 00-57-55

Keyboard event results on https://w3c.github.io/uievents/tools/key-event-viewer.html:

Env

  • OS: macOS Catalina
  • Browser: Google Chrome 83.0.4103.61

I've tested Firefox 76.0.1 and It works as expected.

Maybe, Keyboard event(CompositionEvent) handling is something wrong?

@azu
Copy link
Author

azu commented Jun 6, 2020

I've also tested on "@codemirror/next": "^0.6.0" without exntensions.

import { EditorView } from "@codemirror/next/view";
import { EditorState } from "@codemirror/next/state";

new EditorView({
    state: EditorState.create({
        doc: "",
        extensions: []
    })
});

In this case, Cursor is moved to first of the line after select the highlighted candidate.

Expected result:

日本語|<Cursor is here>

Actual result:

|<Cursor is here>日本語

GIF:

Jun-07-2020 01-06-35

@marijnh
Copy link
Member

marijnh commented Jun 10, 2020

Attached patch should help with this.

@azu
Copy link
Author

azu commented Jun 11, 2020

Is this issue resolved in 0.7.0?

I still met same issue on https://codemirror.net/6/ and "@codemirror/next": "^0.7.0"
Jun-12-2020 00-40-56

Edit: I've noticed that extensions: [] work fine at 0.7.0.

It seem that defaultKeymap cause this issue again.

new EditorView({
    state: EditorState.create({
        doc: "",
        extensions: [
            keymap([
                ...defaultKeymap
            ])
        ]
    })
});

Maybe, insertNewlineAndIndent command has an issue.

@marijnh
Copy link
Member

marijnh commented Jun 11, 2020

Oh, too bad. My patch fixed the issue in Chrome Linux (where it did originally occur too), bit it's entirely possible that macOS IME works differently. I'll test on a Mac soon.

@marijnh marijnh reopened this Jun 11, 2020
marijnh added a commit that referenced this issue Jun 12, 2020
FIX: Fix an issue where using Enter during composition would insert a newline.

Issue #206
@marijnh
Copy link
Member

marijnh commented Jun 12, 2020

Could you try again with 0.7.1?

azu added a commit to azu/voicod that referenced this issue Jun 12, 2020
@azu
Copy link
Author

azu commented Jun 12, 2020

Thanks.
I've confirm that 0.7.1 work fine!

@marijnh
Copy link
Member

marijnh commented Jun 12, 2020

Wonderful!

@marijnh marijnh closed this as completed Jun 12, 2020
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

No branches or pull requests

2 participants