vaadin / vaadin/framework

Combobox filter does not work after removeAllItems

Open
#7,574 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Stale v7
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

Originally by m1kah


Steps to reproduce

  1. Press tab
  2. Press enter to click "Change options" button
  3. Press tab
  4. Type a
  5. Verify that "abcde" is shown in suggestion box
  6. Press shift+tab
  7. Press enter
  8. Press tab
  9. Type a

-Expected behavior*
"abcde" is shown in suggestion box

-Actual behavior*
All values are shown, there is no filtering. Combobox filtering
text field has value 'a'.

Use backspace to remove 'a' and type it again, now filtering works.

You can use this piece of code to reproduce the issue

@Override
protected void init(VaadinRequest vaadinRequest) {
    ComboBox comboBox = new ComboBox();
    Button button = new Button("Change options");
    button.addClickListener((e) -> {
        comboBox.removeAllItems();
        comboBox.addItem("abcde");
        comboBox.addItem("qwerty");
    });
    setContent(new FormLayout(button, comboBox));
}

Imported from https://dev.vaadin.com/ issue #19702

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied ComboBox reproduction and trace filtering after the button calls removeAllItems() and adds the two replacement items. Confirm the suggestion box still filters for the existing text "a" after the options change, and add or run a regression check if the relevant test location can be found.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.