TextField - key listener for ESC and ARROW_DOWN

Hi,
Why you cannot catch ESC and ARROW_DOWN event on TextField? But ENTER is working. I try the following code in only ENTER is catch.
Regards,
Matic

 public void keyListener() {
    TextField searchTF = new TextField();
    searchTF.addKeyPressListener(Key.ESCAPE, e -> {
        Notification.show("ESCAPE");
    });
    searchTF.addKeyPressListener(Key.ENTER, e -> {
        Notification.show("ENTER");
    });
    searchTF.addKeyPressListener(Key.ARROW_DOWN, e -> {
        Notification.show("ARROW_DOWN");
    });
    add(searchTF);
}

Hi.

This behavior might have caused by the GWT internals spoiling some button codes for us (this is the case for Vaadin 8).
This needs further investigation, have created a ticket for it: https://github.com/vaadin/flow/issues/4351
Feel free to subscribe for it to get the results.

Thank you.

I’ve updated the ticket.

Posting some details here as well:
This is how JS works.
Key press event is not always fired for any keys. JS doesn’t allow handle key press events for ESC and other special keys via event handler.
But you may add a listener for key down and key up events which always works.

So please use addKeyDownListener/addKeyUpListener methods instead.

for example to clear the TextField

//add escape behavior
        this.addKeyDownListener(Key.ESCAPE, event -> this.clear());