Skip to content

Enter key down as IME's convert-decision-operation accidentally send to standard input #16413

Open
@Paalon

Description

@Paalon

Description

We can't use decision-operation (確定)by enter-key on Japanese IME on macOS on Safari or Chrome with macOS standard Japanese IME or Google 日本語入力 (Google Japanese IME) on standard input like Python's input() in code block. There is no problem on Firefox.
Come from https://teratail.com/questions/4d0bm1aqv9tye5 (Japanese, StackOverflow-like site).

The table work or fail on environments

IME Safari Chrome Firefox
macOS Japanese IME fail fail work
Google 日本語入力 fail fail work

I only checked for macOS. I don't know there are problems for Windows or Ubuntu etc.

Reproduce

  1. Prepare macOS.
  2. Install Japanese IME (macOS Japanese IME (preinstalled) or Google 日本語入力)
  3. Write the following Python script in the code block:
text = input()
print(text)
  1. Run the code block.
  2. Input something (e.g. 今日はいい天気です) in Japanese IME and press enter key as convert-decision-operation.
  3. Accidentally, the content is send.

Expected behavior

The content is not send, only do convert-decision-operation.

Context

  • Operating System and version: macOS Ventura 13.6.7
  • Browser and version:
    • Chrome 125.0.6422.142 (not work)
    • Safari 17.5 (18618.2.12.111.5, 18618) (not work)
    • Firefox 126.0 (work well)
  • Jupyter Notebook version:
$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.23.0
ipykernel        : 6.29.4
ipywidgets       : not installed
jupyter_client   : 8.6.2
jupyter_core     : 5.7.2
jupyter_server   : 2.14.1
jupyterlab       : 4.2.1
nbclient         : 0.10.0
nbconvert        : 7.16.4
nbformat         : 5.10.4
notebook         : 7.2.0
qtconsole        : not installed
traitlets        : 5.14.3

Information

To use Japanese IME, convert-decision-operation is mandatory.
There is some notes about keydown event handling with Japanese IME:

Firefox(68.0.1)とWindowsのGoogle Chromee(75.0.3770.142)では期待通りに動作します。
MacのGoogle Chrome(75.0.3770.142)とSafari(12.1.2)では、日本語を入力するとき、期待通りに動作しません。

The post written 2020 says we need special treatment for macOS + Safari and macOS + Chrome, and don't need for macOS + Firefox and Windows + Chrome. And need to use KeyboardEvent.keyCode or keypress event but both of them are deprecated.

This post written in 2023 also uses KeyboardEvent.keyCode as a solution.

Moved from posted at jupyter/notebook#7389.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtag:KeyboardCompatibility issues with keyboards, including locale-specific and layout-specific issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions