Not signed in
Copyright © 2026 Unity Technologies
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(); } });
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
Sign in to see your voted issues