Wednesday, August 25, 2010

XPiNC: Prevent tabs being closed on ESC

A reader of my blog asked me how to prevent tabs being closed when pressing escape in XPages running in the Notes Client.

This client side code seems to work in Notes 8.5.2 at least:
dojo.addOnLoad( function(){ 
dojo.connect( document, 'keydown', function(e){
// 27 -> Key code for ESC -> stop event
if(e.keyCode === 27){ dojo.stopEvent(e); }
});
});