I have a textField with a regular keyDown listener.
The event fires when it should, but browser sends a request on every keypress.
That doesn’t seem right.
@Route(value="/test")
public class Test extends VerticalLayout {
public Test() {
var textField = new TextField("TextField");
textField.addKeyDownListener(Key.ESCAPE, event -> {
System.out.println("ESC:\n" + event.toString());
});
add(textField);
}
}
Doesn’t mean it is right though.
Seems like it should’ve been filtered both on the client-side and the server-side.
Not sure how to feel about this one. Vaadin is a chatty app anyway, so maybe I’m overthinking this, but it just feels wrong to generate pointless traffic.
I guess I’ll use the element-level filtered event handler instead.
That also seems wrong; using a low-level API when a high-level API is available, but in this case I think it is the least wrong.
Yes. Sometimes so. That is why in TextField there are the value change modes, so that you can control it. But that applies only the value change event.