Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
New items in ComboBox without enter key
As of now if a ComboBox is set to allow new items (and immediate) you still have to press the enter or tab key in order for the new item being added. A lot of our customers are complaining because they cannot add new items. Most of them find out eventually but cause a support request first because they think something is broken. I guess they enter something and click into the next form field with the mouse. Unfortunately this removes the previously entered text without adding it as a new item.
I can replicate this issue with the most recent version as of writing (7.5.8) with reindeer and valo. Code for the ComboBox is
ComboBox cb = new ComboBox("blargh"); cb.setNewItemsAllowed(true); cb.setImmediate(true); cb.addItem("foo"); cb.addItem("bar");
Is there any way to add it on lost focus regardless of whether the enter key has been pressed?
this will also enter it with tab
it's a known issue, this behaviour is intentional, but the situation is not final, you can track progress here: https://dev.vaadin.com/ticket/18366
In the meantime, you could try to use an addon which tackles this problem: https://vaadin.com/directory#!addon/legacycombobox
Hi Sergey, thanks for the heads-up. I really hope they fix it.