DateField / DateTimeField value change event trigerred too late? Possible V

Simple scenario using Vaadin 8.6.0 archetype project:

  • Button and DateTimeField (resolution SECOND)

Button has clickListener
DateTimeField has valueChangeListener

  1. Open calendar popup
  2. Change one of time dropdowns (hour / minute / second)
  3. Click on button (do not click anywhere else, do not blur date field!)

Events received:

  1. Button pressed
  2. DateTimeField value changed

Above wrong order causes a lot of complications.

When we use TextField (with Value change on BLUR) instead DateTimeField events received:

  1. TextField value change
  2. Button pressed

Code to reproduce:

    	final VerticalLayout layout = new VerticalLayout();
        
        DateTimeField dateField = new DateTimeField();
        dateField.setResolution(DateTimeResolution.SECOND);
        dateField.addValueChangeListener(event -> {
        	System.out.println("Date field value: " + event.getValue());
        });
        
        Button button = new Button("test");
        button.addClickListener(ev -> {
        	System.out.println("Clicked!");
        });
        
        layout.addComponents(button, dateField);
        setContent(layout);

Hi,

does this behavior also occur on older versions? In any case, you should create a ticket at https://github.com/vaadin/framework/issues .

-Olli

I’ve tested only on 8.5.2 and 8.6.0, issue created: https://github.com/vaadin/framework/issues/11316

Thanks!