vaadin / framework

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

ComboBox does not select value if User enters the value manually and TABs out fast #6671

Open vaadin-bot opened 9 years ago

vaadin-bot commented 9 years ago

Originally by jonas.hahn


Setup

Given is a Month-Combobox with Values from 01 to 12 and a Year-Combobox with Values from 2015-2025. Before and after the ComboBoxes are TextBoxes to simulate tabbing from/into another component. To verify the currently chosen Value a Label displays the ComboBox values and updates on change.

Problemcase

Our client's employees get routine in entering data and make use of TABbing from one field to the next one. If they enter a month e.g. 01 and press TAB directly after it the ComboBox does not record the value, but resets to the Prompt (MM) or the value which was entered before (e.g. going back into the field and changing a 04 to a 06 and TABbing on results in 04 still being the value of the ComboBox).

This only happens if entering the value and tabbing on are in very fast succession. If the connection is slow it happens more often.

Ideas

I assume the ComboBox is only able to select, if it has loaded its selections. Are there any suggestions for a workaround/fix?

#!java
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextField;

public class ComboBoxBug extends AbstractTestUI implements ValueChangeListener {

    private Label currentSelection = new Label();
    private ComboBox monthBox = new ComboBox();
    private ComboBox yearBox = new ComboBox();

    @Override
    protected void setup(VaadinRequest request) {

        monthBox.setInputPrompt("MM");
        monthBox.addValueChangeListener(this);

        for (int month = 1; month <= 12; month++) {
            monthBox.addItem(String.format("%02d", month));
        }

        yearBox.setInputPrompt("YYYY");
        yearBox.addValueChangeListener(this);

        for (int year = 2015; year <= 2025; year++) {
            yearBox.addItem(String.format("%04d", year));
        }
        addComponent(new TextField("Just a Placeholder"));
        addComponent(monthBox);
        addComponent(yearBox);
        addComponent(new TextField("Just a Placeholder"));
        addComponent(currentSelection);

    }

    @Override
    public void valueChange(ValueChangeEvent event) {
        currentSelection.setCaption(monthBox.getValue() + " "
                + yearBox.getValue());
    }

}

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

vaadin-bot commented 9 years ago

Originally by @macprzepiora


The problem is most probably caused by the fact that ComboBox is lazy-loading the options from the server-side. combined with server-side filtering of the options as the user types. This calls for a fix, but in the meantime I'd suggest to work it around with NativeSelect, which is not lazy-loading and doesn't need to fetch any data when the user types while it has focus. So, if that's possible, use NativeSelect instead of ComboBox, at least until this ticket is fixed.

vaadin-bot commented 8 years ago

Originally by @samie


Any status update on this?

vaadin-bot commented 8 years ago

Originally by @MTzukanov


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

stale[bot] commented 6 years ago

Hello there!

It looks like this issue hasn't progressed lately. There are so many issues that we just can't deal them all within a reasonable timeframe.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!

TatuLund commented 4 years ago

This issue should not happen with Vaadin 8 anymore as similar bug was fixed by https://github.com/vaadin/framework/pull/11436

However this may be still a problem with Vaadin 7.

stale[bot] commented 3 years ago

Hello there!

We are sorry that this issue hasn't progressed lately. We are prioritizing issues by severity and the number of customers we expect are experiencing this and haven't gotten around to fix this issue yet.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!