app/javascript/js/controllers/modal_controller.js in avo-3.13.7 vs app/javascript/js/controllers/modal_controller.js in avo-3.14.0
- old
+ new
@@ -1,10 +1,16 @@
import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
- static targets = ['modal']
+ static targets = ['modal', 'backdrop']
+ static values = {
+ closeModalOnBackdropClick: true,
+ }
+
close() {
+ if (event.target === this.backdropTarget && !this.closeModalOnBackdropClickValue) return
+
this.modalTarget.remove()
document.dispatchEvent(new Event('actions-modal:close'))
}
}