An outlet for my obsession with technology
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…
No related posts.
| Print article | This entry was posted by Eric Polerecky on September 4, 2008 at 2:49 pm, and is filed under Dojo. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 1 year ago
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.
about 1 year ago
good way!