Removing eager TextChangeListener clears TextField

I want to enable a button in the form right after something has been entered in a TextField. When using ValueChangeListener or TextChangeListener in default (LAZY) mode there is a small delay between when the text is entered and the event is fired, so I thought I would use the listener in EAGER mode. As I only need to get the event once I thought I’d remove the listener when the first event is fired, which is where I get the problem:

With following code the text I enter is removed when the listener is removed. Usually it means the first letter, but if I paste text in all will be cleared. So, for example when I type in asd, usually the ‘a’ is removed as I am typing and only ‘sd’ will remain in the field.

    protected void init(VaadinRequest request) {
        ...
        TextField tf = new TextField();
        tf.addTextChangeListener(this);
        tf.setTextChangeEventMode(TextChangeEventMode.EAGER);
        ...
    }
    
    @Override
    public void textChange(TextChangeEvent event) {
        ((TextField) event.getComponent()).removeTextChangeListener(this);
        button.setEnabled(true);
    }

Does anybody know what I am doing wrong? Or is this a bug and I should be submitting a report?

I tried vaadin versions 7.0.5 and 7.1.6

The TextChangeListener does not change the field’s value, and after you remove it I think the value of the field is set to the latest value received via a text change event, and then recommunicated from the server side to the client side. If you manage to type a letter during the request processing, it will be cleared by the value sent from the server side.

Unfortunately I’m not aware of a workaround for this.