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

Combobox dropdown always marks the first item as selected #12557

Closed
rkovarik opened this issue Sep 29, 2022 · 2 comments
Closed

Combobox dropdown always marks the first item as selected #12557

rkovarik opened this issue Sep 29, 2022 · 2 comments

Comments

@rkovarik
Copy link

rkovarik commented Sep 29, 2022

  • Vaadin Framework version: 8.16

  • Description of the bug:

  1. Having a combobox with multiple pages in the dropdown.
  2. Select an item from a next page from the dropdown (any page except the first one)
  3. Open the dropdown again, you can see that the first item is marked as selected.
  4. Confirm by enter. The value is changed without user realising.
  • Expected behaviour: nothing is selected

  • Actual behaviour: the first item is selected

  • Minimal reproducible example:

ComboBox<Integer> comboBox = new ComboBox<>("", IntStream.range(0, 100).boxed().collect(Collectors.toList()));
comboBox.setEmptySelectionAllowed(false);

Workaround:
A] Educate users to not use ENTER to close the dropdown.
B] comboBox.setScrollToSelectedItem(true); Be aware:

This requires finding the index of the item, which can be expensive in many large lazy loading containers.

@TatuLund
Copy link
Contributor

TatuLund commented Sep 30, 2022

Yes, this is a known behavior of Vaadin 8's ComboBox. I agree it is not the best possible. Thus when we rewrote ComboBox in our newer generation framework, we changed the behavior. Interesting thing was that some of our customers who have migrated from Vaadin 8 to Vaadin 14 or later, wanted to retain this behavior, so we have made add-on for our newer framework version, that has this Vaadin 8 behavior retained.

https://vaadin.com/directory/component/combo-box-with-vaadin-8-behavior

This raises the question, that if we would decide to "fix" this, or change this. Should we do it so that we introduce API that allows the select the behavior.

Note: Vaadin 8.16 is distributed under commercial license. Vaadin 8.14.3 was the last one released under Apache 2 terms. If you have commercial license from Vaadin, you can open request about this issue at https://support.vaadin.com/

@rkovarik
Copy link
Author

Thx @TatuLund for the explanation,

we will try the workaround. If needed, we will open a support request.

Roman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants