Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combox autocomplete list weird selection behaviour #12941

Open
jbennink opened this issue Feb 13, 2025 · 3 comments · May be fixed by #12999
Open

Combox autocomplete list weird selection behaviour #12941

jbennink opened this issue Feb 13, 2025 · 3 comments · May be fixed by #12999
Assignees
Labels
🚧 work in progress Work that is current in progress

Comments

@jbennink
Copy link

jbennink commented Feb 13, 2025

.NET version

Tested with NET9.0.200.

Did it work in .NET Framework?

Not tested/verified

Did it work in any of the earlier releases of .NET Core or .NET 5+?

No response

Issue description

The issue is that when you first open de dropdownlist, and then start typing to autocomplete it creates a seperate short list that matches you autocomplete (looks werid those two lists on top of each other). But then when you try to select an item with the mouse in the autocomplete list, it actually selects an item from the opend dropdownlist. Tryin to navigate the autocomplete list with the keyboard and selecting by pressing enter does nothing, no selection from either list.

Expected behaviour
I would have expected the autocomplete (filtering) to occur in the actual Dropdown list to prevent these double lists from displaying.

OR

When starting to type, close the dropdownlist, and show the autocomplete list. This might prevent the selection issue that occurs

Steps to reproduce

Run the samples from this github: https://github.com/jbennink/WinFormsApp-TestCombobox

Demo movie in repo:

WinFormsApp-TestCombobox_eC5825XdQA.mp4
  • First click the dropdown button to open the dropdownlist
  • Then (with the cursor in the edit field) type an L
  • This open a second list/window with the autocomplete set
  • Selecting with the mous does not select the autocomplete list, but selects items from the dropdownlist below
@jbennink jbennink added the untriaged The team needs to look at this issue in the next triage label Feb 13, 2025
@Zheng-Li01
Copy link
Member

The issue reproduces from .NET 6.0 to latest .NET 10.0 & Framework. and the issue only reproduce when firstly open the dropdown list panel, then input the "L" character. cannot reproduce when input the "L" character directly as below screenshot.
Image

@Epica3055 Epica3055 self-assigned this Feb 18, 2025
@merriemcgaw
Copy link
Member

Thank you for documenting this issue. It certainly is an inconvenience for the end user. Given that it behaves the same in .NET Framework, we are inclined to close the issue, as it doesn't make the current bar. @jbennink, if this is something that you really want to have addressed, we would be more than interested in taking a PR from you. But at this point I will close the issue.

@merriemcgaw merriemcgaw closed this as not planned Won't fix, can't repro, duplicate, stale Feb 18, 2025
@dotnet-policy-service dotnet-policy-service bot removed the untriaged The team needs to look at this issue in the next triage label Feb 18, 2025
@Epica3055
Copy link
Member

I can provide you an workaround you can try and see if it fixes your problem

            comboBox1.TextChanged += ComboBox1_TextChanged;
        }

        private void ComboBox1_TextChanged(object? sender, EventArgs e)
        {
            if (comboBox1.Text.Length > 0)
            {
                // close dropdown

                foreach (var item in comboBox1.Items)
                {
                    if (item?.ToString()?.StartsWith(comboBox1.Text, StringComparison.CurrentCultureIgnoreCase) == true)
                    {
                        comboBox1.DroppedDown= false;
                    }
                }
            }
        }

@dotnet-policy-service dotnet-policy-service bot added the 🚧 work in progress Work that is current in progress label Feb 21, 2025
@LeafShi1 LeafShi1 reopened this Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚧 work in progress Work that is current in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants