vaadin / framework

Vaadin 6, 7, 8 is a Java framework for modern Java web applications.
http://vaadin.com/
Other
1.79k stars 729 forks source link

Blurring a ComboBox with new items allowed by clicking outside causes the entered value to be lost #6914

Closed vaadin-bot closed 7 years ago

vaadin-bot commented 9 years ago

Originally by f92dev


Since Vaadin 7.5.0 setting ComboBox.setNewItemsAllowed(true) for combo boxes does not work like before.

In my application I'm using some combo boxes to input text and I noticed that the method NewItemHandler.addNewItem is not called when the combos lose the focus. This new behavior could be annoying because jumping from the combobox to a save button doesn't sets the expected value.

ComboBox cb = new ComboBox();
cb.addItem("test");
cb.addItem("pippo");
cb.addItem("dummy");
cb.setNewItemsAllowed(true);
cb.setNewItemHandler(s -> {
    // add new item ....
    System.out.println("not called on blur");
});

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

vaadin-bot commented 9 years ago

Originally by SteveDemy


New data is retained when navigating away from the combobox using tab, but not when clicking outside the combobox.

vaadin-bot commented 9 years ago

Originally by davengo


Attachment added: VFilterSelect_18366.patch (0.8 KiB) Patch for textInputEnabled && allowNewItem

vaadin-bot commented 9 years ago

Originally by davengo


The bug still exists in Version 7.5.3 - added our first patch to fix this problem.

Best wishes from Germany Stefan Müller davengo coding team

vaadin-bot commented 9 years ago

Originally by @Legioth


https://dev.vaadin.com/review/#/c/7117/ intentionally introduced this behavior: Closing the suggestions list by clicking outside the list no longer selects an item to prevent accidental selections.

Both alternatives have their pros and cons, but I wouldn't consider either of them to be defective. It could be considered to make the behavior configurable.

vaadin-bot commented 8 years ago

Originally by andreas


We recently updated to the latest Vaadin version and this new "feature" also broke the usability of our UI. Please make it at least configurable, if you don't want to go back to the old behavior.

vaadin-bot commented 8 years ago

Originally by g-land


We have a combobox where the user can select an existing IP address or add a new one, then many users simply click the mouse on the next field. this simple operation "forgets" the newly entered IP address and is really misleading users.

vaadin-bot commented 8 years ago

Originally by sergey@vaadin.com


You could try this addon in the meantime: [https://vaadin.com/directory#!addon/legacycombobox]

vaadin-bot commented 8 years ago

Originally by g-land


Tried it, works fine ! Thanks

vaadin-bot commented 8 years ago

Originally by mrotteveel


We are also confronted with this problem. I don't agree with this ticket being classified as "enhancement", it is clearly a bug and a very annoying one if you use a combobox for selection and user input.

vaadin-bot commented 8 years ago

Originally by whahn


We are getting complaints from users about this about every other week. This is a huge usability issue.

vaadin-bot commented 8 years ago

Originally by ppinon


It's a big problem for me too.

We definitely need to have this behavior configurable because it's very error prone for the final user to not have its item added when it click outside the field.

vaadin-bot commented 8 years ago

Originally by chkpnt


We are also affected by this bug.

vaadin-bot commented 7 years ago

Originally by @Artur-


Not sure why this would be considered a "feature". The original change seems to have forgotten to consider that "new items allowed" even exists. When would it be desired behavior to enter "sometext" into a ComboBox, tab out and have ComboBox forget about the text?

vaadin-bot commented 7 years ago

Originally by @Artur-


Correction to my comment as tab seems to work correctly.

How could anybody expect

  1. enter "abc"
  2. move to next field using tab

To be different from

  1. enter "abc"
  2. move to the next field using the mouse
vaadin-bot commented 7 years ago

Originally by @jouni


Leif, exactly. This is a bug, and the behavior should be reverted to the previous one, where blurring the field by any means (tabbing or clicking outside) works the same way.

And as a best practice, it’s always safer to keep any explicit user input rather than resetting it to something else without clear feedback. When new items (or custom values) are not allowed, we can revert to the previous valid value when the field is blurred, although it would be safer to mark the field invalid instead.

vaadin-bot commented 7 years ago

Originally by @Artur-


https://dev.vaadin.com/review/#/c/14735/

vaadin-bot commented 7 years ago

Originally by @pleku


Fixed by https://github.com/vaadin/vaadin/commit/3f97add7d89064a734b231de2cffac467a53fcab

RobertZenz commented 7 years ago

The fix for this has the behavior that the blur event is send/fired and the selected event afterwards because the item action is executed deferred. Is that intended? Because that means that the server will receive the blur before the selected, ideally they would receive both at the same time.