frontend/js/components/dialog.js in trestle-0.9.5 vs frontend/js/components/dialog.js in trestle-0.9.6
- old
+ new
@@ -18,18 +18,23 @@
$el.modal({
show: false,
focus: false
})
- // Remove dialog elements once hidden
$el.on('hidden.bs.modal', function () {
+ // Restore modal-open class on body if background modals still visible
+ if ($el.prevAll('.modal.show').length) {
+ $(document.body).addClass('modal-open')
+ }
+
+ // Remove dialog elements once hidden
$el.remove()
})
// Restore the next visible modal to the foreground
$el.on('hide.bs.modal', function () {
- $el.prevAll('.modal.in').last().removeClass('background')
+ $el.prevAll('.modal.show').last().removeClass('background')
})
// Set X-Trestle-Dialog header on AJAX requests initiated from the dialog
$el.on('ajax:beforeSend', '[data-remote]', function (e) {
const xhr = e.detail[0]
@@ -118,10 +123,10 @@
show () {
this.$el.modal('show')
// Background any existing visible modals
- this.$el.prevAll('.modal.in').addClass('background')
+ this.$el.prevAll('.modal.show').addClass('background')
}
hide () {
this.$el.modal('hide')
}