ConfirmDialog on Vaadin flow doesn't show up

I’m using Vaain 10 and I’m fighting with ConfirmDialog which should be super easy to add to my app.
I followed the installation guide [here]
(https://vaadin.com/components/vaadin-confirm-dialog)

I have added a listener to a button and added the following code - the first line shows up in my console but the confirm dialog does not show up nor any exception in the logs.

pom file attached.

private void openOwnersDialog(ClickEvent<Button> event) {	
		System.out.println("Called"); //This is called
		ConfirmDialog dialog = new ConfirmDialog("Unsaved changes",
		        "Do you want to save or discard your changes before navigating away?",
		        "Save", this::onSave);
		
	}
	
	public void onSave(ConfirmEvent l) {
		
	}

17677334.xml (5.35 KB)

Hello Yinon

You need to open the dialog after creating it, otherwise it won’t show up.

ConfirmDialog dialog = new ConfirmDialog(.....);
dialog.open(); // this will display the dialog

Damn, thank you :slight_smile: I was looking for the show method (that used to be on the old confirmed dialog) .
All examples in Vaadin doesn’t show the call to open method.

Anyway it works ,
THANKS,
Yinon

You are right, in the [examples page]
(https://vaadin.com/components/vaadin-confirm-dialog/java-examples) for ConfirmDialog, no example actually shows the dialog.open(); line. And you were not the first today to ask exactly this question :). Hopefully the examples get updated some time.

Looks like there’s already a ticket for that, too: https://github.com/vaadin/vaadin-confirm-dialog-flow/issues/71