Pressing enter two times, calls the callback function two times #514

goblinbr opened this Issue May 4, 2016 · 6 comments


None yet

3 participants

goblinbr commented May 4, 2016 edited

When you press enter two times really fast the callback function is called two times.

Also occurs when you click two times the confirm button


I am using Chome 50.0.2661.94 m , also tested with Firefox 43.0.1


I'm experiencing this exact problem.


Also, spamming the OK button with the mouse calls the callback multiple times.


As a workaround, you can set a flag when closing the modal and reset it on event.

var flag = false;
bootbox.confirm("Confirm?", function(conf) {
        if (conf && !flag) {
            flag = true;
            /* ... */
    .on("", function() {
        flag = false;

Or as a fix, you can add this snippet somewhere to override bootbox's dialog function:

 * Prevent multiple callback calls when spamming click, 'enter' or 'esc'.
bootbox.dialog = (function(dialog) {
    return function(options) {
        var modal = dialog(options);
        modal.on("", function() {
        return modal;

Definite bug which needs addressing - thanks.

@makeusabrew makeusabrew added the Bug label Sep 23, 2016
emileber commented Dec 9, 2016

@makeusabrew The last release is dating, when is the next patch/minor release planned?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment