Search Issue Tracker

Won't Fix

Votes

0

Found in

6000.0.47f1

6000.1.0b15

6000.2.0a9

Issue ID

UUM-103308

Regression

Yes

TextField.RegisterCallback<KeyDownEvent>() doesn't collect keystrokes when entering text into the TextField

-

Reproduction steps:
1. Open the attached project "ReproProj"
2. Open “Echo Console“ (Window > General > Echo Console)
3. In the TextField, enter “Hello“
4. Press the “Enter” key twice
5. Enter “Hey“
6. Press the “up” arrow key

Expected result: Arrow keys access input history, and the “Hello” appears in the TextField
Actual result: Caret moves to the front of the entered text

Reproducible with: 2023.2.0a6 (5de4d4fd9e52), 6000.0.47f1, 6000.1.0b15, 6000.2.0a9
Not reproducible with: 2022.3.61f1, 2023.2.0a5 (e4a766a8b34d)

Testing environment: Windows 10 Enterprise 21H2
Not reproducible on: No other environment tested

  1. Resolution Note:

    To prevent the default handling of the arrow keys by the TextField, you need to register the callback as a "TrickleDown" callback, meaning that you will receive the event before it is processed by the TextField. You can then have your own handling of it and stop the propagation of the event.

    In your case, you want to keep the handling of the "Enter" as a "NoTrickleDown" callback (assuming you want to keep the double "Enter" to submit the value).

    Here is an updated version of your callbacks that should achieve your desired result:

    // *** THE POINT OF MY BUG SUBMISSION IS THIS CALLBACK ***
    // Customize hotkeys for the input textfield
    input.RegisterCallback<KeyDownEvent>(evt =>
    {
    // Hitting up and down advances through the input history to use prior submissions
    if (evt.keyCode == KeyCode.UpArrow)
    {
    if (_inputHistory.Count > 0)
    {
    if (_inputHistoryIndex > 0)
    {
    _inputHistoryIndex--;
    }
    input.value = _inputHistory[_inputHistoryIndex];
    input.textSelection.cursorIndex = input.textSelection.selectIndex = input.value?.Length ?? 0;
    evt.StopImmediatePropagation();
    }
    }
    else if (evt.keyCode == KeyCode.DownArrow)
    {
    if (_inputHistory.Count > 0)
    {
    if (_inputHistoryIndex < _inputHistory.Count - 1)
    {
    _inputHistoryIndex++;
    }
    input.value = _inputHistory[_inputHistoryIndex];
    input.textSelection.cursorIndex = input.textSelection.selectIndex = input.value?.Length ?? 0;
    evt.StopImmediatePropagation();
    }
    }
    }, TrickleDown.TrickleDown);

    input.RegisterCallback<KeyDownEvent>(evt =>
    {
    // Hitting enter submits the text of the input textfield
    if (evt.keyCode == KeyCode.Return || evt.keyCode == KeyCode.KeypadEnter)
    {
    onSubmit();
    }
    });

Comments (1)

  1. joey81

    Apr 16, 2025 12:49

    GET RICH WITH BLANK ATM CARD, Whats app: + 1 9 7 9 3 6 2 1 4 3 7

    I want to testify about Dark Web blank atm cards which can withdraw money from any atm machines around the world. I was very poor before and have no job. I saw so many testimony about how Dark Web Online Hackers send them the atm blank card and use it to collect money in any atm machine and become rich {DARKWEBONLINEHACKERS @ GMAIL . COM} I email them also and they sent me the blank atm card. I have use it to get 500,000 dollars. withdraw the maximum of 5,000 USD daily. Dark Web is giving out the card just to help the poor. Hack and take money directly from any atm machine vault with the use of atm programmed card which runs in automatic mode.

    You can also contact them for the service below

    * Western Union/MoneyGram Transfer

    * Bank Transfer

    * PayPal / Skrill Transfer

    * Crypto Mining

    * CashApp Transfer

    * Bitcoin Loans

    * Recover Stolen/Missing Crypto/Funds/Assets

    Email: darkwebonlinehackers @ g m a i l . c o m

    Whats App: + 1 9 7 9 3 6 2 1 4 3 7

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.