4th September
2008
written by Eric Polerecky

Dojo likes to trap events, as such the current way to disable the escape key for dialogs is to use dojo.stopEvent(evt) …

 

   1:  dojo.connect(dijit.byId("disclaimer_dialog").containerNode, 'onkeypress', function(evt) {
   2:              key = evt.keyCode;
   3:              if (key == dojo.keys.ESCAPE) {
   4:                  console.debug("Escape trapped !!")
   5:                  dojo.stopEvent(evt);
   6:              }
   7:          });

 

I’m starting to feel like there is “the dojo way” and them um…expected way…

Maybe I just missed it but why isn’t there a property for “disableEscape” or “allowEscape” …whatever…it works right…

1 Comment

  1. Alonso
    06/11/2008

    Hi Eric, thank you so much, I almost eat my hat with the escape key. To copy your code I had to view the page source code because it doesn’t appears very well on browser.

Leave a Reply