Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Holding down on ListSelect with ValueChangeListener causes selection to jum
I'm working on a webapp which has a ListSelect with a ValueChangeListener. When selecting a value and holding the down key, the selection scrolls down for a bit, then jumps up, then starts going all over the place. It can be reproduced by the following:
ListSelect select = new ListSelect();
for(int i = 0; i < 100; i++)
{
select.addItem(i);
}
select.setWidth(200, Unit.PIXELS);
select.setHeight(200, Unit.PIXELS);
select.addValueChangeListener(new Property.ValueChangeListener()
{
@Override
public void valueChange(ValueChangeEvent event)
{
try
{
Thread.sleep(200);
}catch(InterruptedException e)
{
}
}
})
Note that the Thread.sleep is not necessary if there is latency between the server and client. All that is needed is an empty ValueChangeListener.
So it seems that vaadin is reselecting the value that was sent to the server when the server's response is received. Is there a way to avoid this behaviour or work around it, so that the selection doesn't jump around when the user holds the down key?
Thanks,
Anthony