How to make bootbox closing when using custom dialog

This should do it. Please note this has only been tested on v3. using bootstrap 2.3.2

$(document).on('click', '.modal-backdrop', function (event) {
    bootbox.hideAll()
});

To be honest I've never really used modal - it came from a PR a long, long time ago but I've never been convinced of its use case. No good to you now but the method is actually commented as being deprecated in v3.0.0 and will probably actually be removed in future versions - it just doesn't really fit (to me) what Bootbox was created for and as other methods have been tweaked, improved and tested it's sat there somewhat neglected.

But you can do something like this

$(document).keyup(function(e) {
  if (e.keyCode == 27) {box.modal("hide");}   // esc
});

Add an onEscape callback function, which may have an empty body.

See docs and example.

Basic code:

bootbox.dialog({
   onEscape: function() {},
   // ...
});