microsoft / microsoft/microsoft-ui-xaml
The Down Arrow key does not trigger the KeyDown event when the cursor is at position 0 in the TextBox
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
The KeyDown event is not triggered for the Down Arrow key when the cursor is at position 0 in the TextBox. Only the KeyUp event is fired correctly when pressing the Down Arrow key.
This issue occurs only when the TextBox contains text. If the TextBox is empty, the KeyDown event is triggered as expected.
```Xml
```
```C#
private void TextBox_KeyDown(object sender, KeyRoutedEventArgs e)
{
Debug.WriteLine("The TextBox Key Down fired : " + e.Key.ToString());
}
private void TextBox_KeyUp(object sender, KeyRoutedEventArgs e)
{
Debug.WriteLine("The TextBox Key Up fired : " + e.Key.ToString());
}
```
### Steps to reproduce the bug
1. Run the attached sample.
2. Tap the TextBox (ensure the cursor is at the 0th position).
3. Press the Down Arrow key on the keyboard.
4. Observe the Output window, the KeyDown event is not triggered, only the KeyUp event is triggered
[Sample App](https://github.com/user-attachments/files/19845562/App1.zip)
### Expected behavior
The KeyDown event should be triggered properly when pressing the Down Arrow key.
### Screenshots
https://github.com/user-attachments/assets/453b0267-53c9-4468-88b8-d9adfdf77d51
### NuGet package version
WinUI 3 - Windows App SDK 1.7.1: 1.7.250401001
### Windows version
Windows 11 (23H2): Build 22631
### Additional context
_No response_
Contributor guide
Research direction
Start by running the attached App1.zip sample and reproducing the Down Arrow behavior with the cursor at position 0 in a non-empty TextBox. Trace the TextBox keyboard input path and its existing tests, if available; done means KeyDown fires as expected while KeyUp continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100