Key Shortcut does not work in Confirm Dialog

This is very weird behaviour as i can’t get any key shortcut to work in a vaadin dialog component.


even this fails to work


Should work

Thanks @quirky-zebra but this does not work , i even tried in vaadin 24.

public HelloWorldView() { sayHello = new Button("Say hello"); sayHello.addClickListener(ignore ->{ final var confirmDialog = new ConfirmDialog(); confirmDialog.setConfirmText("Please confirm"); confirmDialog.setCloseOnEsc(true); final var confirmButton = new Button("Confirm"); confirmButton.addClickShortcut(Key.KEY_J) .listenOn(confirmDialog); confirmDialog.setConfirmButton(confirmButton); confirmDialog.addConfirmListener(e->{"Confirmed"); });; }); add(sayHello); }

Workaround would be to use confirmDialog.setModal(false)

Could be a regression, this behavior was fixed last year

can’t spot any public method .setModal(false) in ConfirmDialog

That makes it harder :grimacing: use a dialog instead…

@useful-whale fyi: looks like the confirm dialog is not on par with the dialog fixes regarding modularity

Hmm, it should be, since ConfirmDialog is an extension of Dialog :thinking:
And the fixes to that issue you linked are not specific fo Dialog but should apply to any modal container.
Strange. I’ll try to reproduce and create a ticket if I can.

In the meantime, you could try this workaround proposed in that fixed ticket: button.addClickShortcut(Key.ENTER).listenOn(dialog);

(ah, disregard that last part, I see you already do that)

ok yeah, can reproduce.
No idea if the issue is in ConfirmDialog or Flow, but I’ll make a ticket and we’ll see what happens :slightly_smiling_face:


Thanks @useful-whale

Aand it’s fixed. Should ship in the next patches for 23 and onward.

Thanks for the update