disable escape key in dijit.Dialog / dojo dialog

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…

Share and Enjoy:
  • Digg
  • Facebook
  • del.icio.us
  • E-mail this story to a friend!
  • DotNetKicks
  • DZone
  • FriendFeed
  • Twitter

Related posts:

  1. dojo.connect, dojo.byId and dijit.byId