Cannot get dialog to open in route

Using this code:

@Route("test")
public class TestRoute extends VerticalLayout {

    private Button pushme;

    public TestRoute() {
        pushme = new Button("Push Me");
        pushme.addClickListener(e -> {
            Dialog dialog = new Dialog();
            Div content = new Div();
            content.setText("My Dialog");
            dialog.add(content);
            dialog.open();
        });
        add(pushme);
    }
}

The dialog will not open. What gives?

After cleaning my build I was able to make this work properly.

Hello everybody. I also do not open a dialog. By F12 in Chrome, I see that the section is being created, but it doesn’t appear on the screen. How did you solve your problem?