Closed KiteDX closed 3 years ago
I found another case that manages to reproduce this behavior: The selection will persist as long as the "empty string" value is focussed (blue border) inside of the Combobox popup even if you repeatedly open and close the popup. However as soon as the focus is lost (e.b. by opening the box and pressing "ESC" so that the currently selected value loses its blue border) the selection will disappear by the next time you open the popup (it most likely disappears the moment the focus is lost/the popup is closed).
Hi, as you might have already learned from expert chat, this is caused by the vaadin-combo-box
web component using empty string to represent null value. This is mentioned in the value property of the web component, but unfortunately the component documentation doesn't mention that empty strings are not supported.
The only fix we can think of is to change the null representation from empty string to undefined
. The problem with this is that it will change the behavior of the component, at least when used in client-side (i.e. as a pure web component, rather than through Flow), i.e. a breaking change, which we cannot bring to Vaadin 14.x.
We could make this change in Vaadin 22, in which case it will be part of the next LTS version of the platform, but will not be backported to V14. Let us know if you'd like us to look into this option.
As for a workaround for V14, would it be possible for you to use something other than an empty string, such as a whitespace character like non breaking space ( or ) or text like [none]
instead?
As for a workaround for V14, would it be possible for you to use something other than an empty string, such as a whitespace character like non breaking space ( or ) or text like
[none]
instead?
We thought about these as well, but in the end we deemed those workarounds as impracticable:
Is there maybe an option for a separate component that fixes this issue?
That does indeed start to sound like your best option. You can discuss custom development services with Expert Chat or your Vaadin account manager.
I'll create a ticket about mentioning this limitation in the documentation. I presume we can close this warranty bugfix ticket for now?
Sorry for the delay. If a modification for Vaadin14 is not possible, a fix for Vaadin22 would be greatly appreciated (and imho needed for consistency's sake). The current behavior is very inconsistent with the usual behavior of the ComboBox, no matter what other component is used underneath.
Alright, I opened a separate ticket for that: https://github.com/vaadin/flow-components/issues/1900.
Closing this one as this is now a feature/refactorization issue rather than a bug.
Created after discussion with Vaadin Expert Chat. Might be related to https://github.com/vaadin/flow-components/issues/1511, but with impact on usage.
Description
Expected outcome
Actual outcome
Minimal reproducible example
Steps to reproduce
There are different ways to reproduce this behavior (and I think you found some others internally, too?)
Combobox with .focus():
Combobox without .focus():
Environment
Vaadin 14.6.3 (I tested this back until Vaadin 14.1.0 which showed the same behavior. I didn't test versions before then) Windows 10 (latest Updates)