Recommendation: Modal backdrop click should not close modal before it is fully shown
Created by: tenedor
Given a modal with backdrop: true
and a fade
class, double-clicking a button that launches the modal will hide the modal before it has been shown. The first click lands on the button while the second lands on the backdrop. This seems undesirable during a fade
transition and might be undesirable even when there is no delay caused by a transition.
Possibilities:
- ignore all backdrop clicks during the time window presumed to be a doubleclick (Microsoft loosely suggests 500ms)
- ignore backdrop clicks until the
shown
event, thereby handling
Both of these changes reduce Bootstrap's flexibility since a developer can add these behaviors onto Bootstrap but cannot remove them. (A noDoubleClick
option could be added to modals, but this is probably not worth the additional API complexity.) However, it seems more likely that a user would accidentally doubleclick a button than that a user would almost-immediately reclick after misclicking a button; furthermore, it seems more likely that a user would be annoyed by undesired behavior in the first case than in the second case.