Skip to content

Support behavior of IME #547

@freshchild

Description

@freshchild

The input with IME cannot passed to the browser in neko properly.

Steps:

  1. Input in local browser

    Image

  2. Input in neko

    Image

I roughly checked related issues, and

Simple HTML for reproduction:

<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8" />
    <title>IME Event Test</title>
    <style>
        body {
            font-family: sans-serif;
            padding: 20px;
        }

        #log {
            white-space: pre-wrap;
            border: 1px solid #ccc;
            padding: 10px;
            height: 200px;
            overflow-y: scroll;
        }

        input,
        textarea {
            width: 100%;
            font-size: 16px;
            padding: 8px;
            margin-bottom: 10px;
        }
    </style>
</head>

<body>
    <h2>IME Event Test</h2>
    <input id="input" type="text" placeholder="input" />
    <textarea id="textarea" rows="4" placeholder="textarea"></textarea>
    <div id="log"></div>

    <script>
        const logEl = document.getElementById('log');
        function logEvent(e) {
            logEl.textContent += `[${e.type}] data: "${e.data || ''}"\n`;
            logEl.scrollTop = logEl.scrollHeight;
        }

        const input = document.getElementById('input');
        const textarea = document.getElementById('textarea');

        ['keydown', 'compositionstart', 'compositionupdate', 'compositionend', 'input'].forEach(eventType => {
            input.addEventListener(eventType, logEvent, true);
            textarea.addEventListener(eventType, logEvent, true);
        });
    </script>
</body>

</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions