Skip to content

Commit

Permalink
Merge pull request twbs#14724 from twbs/fat-13816
Browse files Browse the repository at this point in the history
fixes twbs#13816 Modal dialog closes when dragging and releasing mouse button outside dialog
  • Loading branch information
fat committed Oct 10, 2014
2 parents 9299f5d + 4bbe806 commit 42311c8
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 26 deletions.
3 changes: 1 addition & 2 deletions dist/css/bootstrap.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/bootstrap.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/bootstrap.min.css

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions dist/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1015,14 +1015,13 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var doAnimate = $.support.transition && animate

this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(this.$body)

this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
if (e.target !== e.currentTarget) return
this.options.backdrop == 'static'
? this.$element[0].focus.call(this.$element[0])
: this.hide.call(this)
}, this))
.prependTo(this.$element)
.on('click.dismiss.bs.modal', $.proxy(function (e) {
if (e.target !== e.currentTarget) return
this.options.backdrop == 'static'
? this.$element[0].focus.call(this.$element[0])
: this.hide.call(this)
}, this))

if (doAnimate) this.$backdrop[0].offsetWidth // force reflow

Expand Down
2 changes: 1 addition & 1 deletion dist/js/bootstrap.min.js

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions js/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,13 @@
var doAnimate = $.support.transition && animate

this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(this.$body)

this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
if (e.target !== e.currentTarget) return
this.options.backdrop == 'static'
? this.$element[0].focus.call(this.$element[0])
: this.hide.call(this)
}, this))
.prependTo(this.$element)
.on('click.dismiss.bs.modal', $.proxy(function (e) {
if (e.target !== e.currentTarget) return
this.options.backdrop == 'static'
? this.$element[0].focus.call(this.$element[0])
: this.hide.call(this)
}, this))

if (doAnimate) this.$backdrop[0].offsetWidth // force reflow

Expand Down
4 changes: 2 additions & 2 deletions js/tests/unit/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ $(function () {
notEqual($('#modal-test').length, 0, 'modal insterted into dom')
$('.contents').click()
ok($('#modal-test').is(':visible'), 'modal visible')
$('#modal-test').click()
$('#modal-test .modal-backdrop').click()
})
.on('hidden.bs.modal', function () {
ok(!$('#modal-test').is(':visible'), 'modal hidden')
Expand Down Expand Up @@ -196,7 +196,7 @@ $(function () {
$('<div id="modal-test"><div class="contents"/></div>')
.on('shown.bs.modal', function () {
triggered = 0
$('#modal-test').click()
$('#modal-test .modal-backdrop').click()
})
.on('hide.bs.modal', function () {
triggered += 1
Expand Down
1 change: 0 additions & 1 deletion less/modals.less
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
right: 0;
bottom: 0;
left: 0;
z-index: @zindex-modal-background;
background-color: @modal-backdrop-bg;
// Fade for backdrop
&.fade { .opacity(0); }
Expand Down
3 changes: 1 addition & 2 deletions less/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@
@zindex-popover: 1060;
@zindex-tooltip: 1070;
@zindex-navbar-fixed: 1030;
@zindex-modal-background: 1040;
@zindex-modal: 1050;
@zindex-modal: 1040;


//== Media queries breakpoints
Expand Down

0 comments on commit 42311c8

Please sign in to comment.