Friday, March 30, 2012

How to close a KendoUI window on ESC key

As far as I could test, it is mandatory to have at least an input control inside the window ( text input, button, etc) in order to have access to the key events and also, as requirement, this control should have the focus on it.Here is my version for this story:
- first, let's create the HTML page that includes the KendoUI framework:

- now, let's add the HTML code that's behind the Kendo window

- let's add also the javascript code that handles the interface controls

- at the end of the HTML file there is also a little styling done:


This solution works on Firefox 11.0 and on IE 9, but on Chrome(and I think Safari also) it does not work because the Chrome browser does not support focus on buttons.
For more details please check this post:
http://stackoverflow.com/questions/2074347/focus-not-working-in-safari-or-chrome (see demo)