Vaadin TextField loses focus when a component is displayed(TextChangeEvent)

Hello everyone,

I am using Vaadin Portlets (6.8.1) with Liferay (6.1 GA1).

I have a TextField and would like to show a component after a TextChangeEvent.
The component will be displayed if the TextField contains more than two
characters. Less than three characters hide them.

In Firefox, everthing works correctly, but in the IE8 the TextField loses the
focus.

The issue happens only in the liferay enviroment and in the IE8. A plain Vaadin
project in Tomcat works correctly.

I have a code demo here:


package TestFocus.windows;

import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeListener;
import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextField;
import com.vaadin.ui.Window;

public class ApplicationWindow extends Window {

public ApplicationWindow() {

final Label label = new Label("result");
label.setVisible(false);

final TextField tf = new TextField("search");
tf.setTextChangeEventMode(TextChangeEventMode.LAZY);
tf.setTextChangeTimeout(200);
tf.setImmediate(true);
tf.addListener(new TextChangeListener() {

public void textChange(TextChangeEvent event) {

if (event.getText().length() > 2 ) {
label.setVisible(true);
} else {
label.setVisible(false);
}
}
});

addComponent(tf);
addComponent(label);
}
}

What am I doing wrong? It’s a bug? Can someone help me?

Many thanks!


Post in Liferay Forum


Vaadin Trac #9157