ComboBox resets selected item to the first one on Esc key press when the drop-down is closed
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
If you focus a ComboBox and press the Esc key, it resets the selected item to the first one. It happens when the ComboBox's drop-down is closed. In the .NET Framework 4.8, it didn't happen.
See the video:
https://github.com/user-attachments/assets/5db212dd-2d89-4fe1-b00d-07d23ace75f0
Here are the repro projects:
[ComboBoxTest.zip](https://github.com/user-attachments/files/19735871/ComboBoxTest.zip)
### Reproduction Steps
- Create a new WPF project in .NET6,8,9 (the bug is reproducible in all 3 versions)
- Add the following code into the MainWindow.xaml into the root Window tag:
```
1
2
3
```
- Run the project, click on the combo-box, click on the 3rd item in the drop-down, and then **press the Esc key** (when the drop-down is closed).
### Expected behavior
The selected item must not be changed on the Esc key press and must remain "3". That's how it worked in .NET Framework 4.8.
### Actual behavior
The selected item is reset to "1" after the Esc key press. That's very counterintuitive.
### Regression?
It's a regression to the .NET Framework 4.8 version.
### Known Workarounds
_No response_
### Impact
_No response_
### Configuration
_No response_
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.