Close a Vaadin modal Window with Esc

Users (or at least i) expect a modal window to close when pressing the Esc key.
Here´s the code snipet for a modal Window with Vaadin:

Now comes the action…

After registering the esc key as close shortcut the window will close when Esc is pressed and the window has the focus.
That´s why we need the window.focus() call after attaching the window to the UI.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.