retrieve the cursor in another window. VAADIN

Hello,

I have a form with a button “Submit”. By pressing the button, if the fields are not filled, I create a popup to display an error message. it works well.
The problem is that this popup has a button “OK” to leave the popup, but it isn’t selected by default. And if I press enter on the keyboard for x times, it displays x new popup.

Thank you in advance for your help.

When you open the popup call focus() on the “OK”-button.

I forgot to put : dialog.addComponent(close);

that’s why I could not have done : close.focus();