Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootbox closes too agressively #705

Closed
av01d opened this issue May 13, 2019 · 2 comments
Closed

Bootbox closes too agressively #705

av01d opened this issue May 13, 2019 · 2 comments

Comments

@av01d
Copy link

av01d commented May 13, 2019

I have the following contents in a bootbox (5.1.0) dialog:

Screenshot 2019-05-13 at 14 11 53

The footer (.modal-footer) contains a dropdown, a bootstrap button-group. Whenever you try to interact with this dropdown, the dialog closes (the dropdown options are never shown).
The cause is this:

dialog.on('click', '.modal-footer button:not(.disabled)', function (e) {
      var callbackKey = $(this).data('bb-handler');
      
      processCallback(e, dialog, callbacks[callbackKey]);
});

All button elements cause a callback to be called. A small code change fixes the issue:

dialog.on('click', '.modal-footer button:not(.disabled)', function (e) {
   var callbackKey = $(this).data('bb-handler');
   if (callbackKey !== undefined) {
      // Only process callbacks for buttons we recognize:
      processCallback(e, dialog, callbacks[callbackKey]);
   }
});
@tiesont
Copy link
Member

tiesont commented May 14, 2019

Sounds like a good candidate for a pull-request. Otherwise, I agree with what you're showing, but it'll be a bit before it gets integrated.

tiesont added a commit that referenced this issue Jul 13, 2019
Modifies dialog to only process button callback if it has been defined; see #705
@tiesont
Copy link
Member

tiesont commented Jul 13, 2019

Implemented in v5.2.0

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

No branches or pull requests

2 participants