microsoft / microsoft/microsoft-ui-xaml
ComboBox sets selected value when using text search with the box open
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
When the combo box is open, we expect that the value is updated only from an action that also closes the box, such as pressing *Enter* or clicking on an item. But it currently also updates the value when using text search, when the user enters letters to find an item. (This set value is seemingly temporary, as the value will be reset back to the original value if the user presses *Esc* or simply clicks out of the box.)
### Why is this important?
That it temporarily sets the value can cause problems when the value change sets off other UX changes, especially if those changes cause the combo box to be re-rendered. This makes the text search essentially useless for that combo box since the re-render then causes it to lose focus and reset back to the original value.
### Steps to reproduce the bug
Using the WinUI 3 Gallery, you can see the effect on the ComboBox page using the color selection box. First, change the color to *Yellow* (This makes the box open above so you can see the actual color value change while it's open.) Then, open it and type the letter *G*. Notice that the color of the box below changes to green. Click somewhere outside the box to see that it resets to yellow.
### Actual behavior
When you type the letter *G* with the combo box open, the bound value updates temporarily to green.
### Expected behavior
When you type with the combo box open, the focus should change to the matching item, but the bound value should not change. This matches the current behavior when you use the arrow keys with the box open.
### Version
WinUI 3 Gallery 2.9.3.0
Contributor guide
Research direction
Start with the ComboBox page in the WinUI 3 Gallery and reproduce the color-selection scenario by selecting Yellow, opening the box, and typing G. Trace the ComboBox selection and bound-value update path; done means text search changes focus without updating the bound value, while Enter or clicking an item still commits the selection.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100