0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

🐛 Fixed closing modals in admin UI when releasing mouse outside modal

no issue

When selecting text, and releasing your mouse outside the modal, the modal would close.
This commit is contained in:
Simon Backx 2023-06-08 13:50:44 +02:00
parent 5658f4b627
commit 5949d6a8d4

View file

@ -36,7 +36,7 @@ export default class ModalsService extends EPMModalsService {
addEventHandlers() {
if (!this.backdropClickHandler) {
this.backdropClickHandler = bind(this, this.handleBackdropClick);
document.body.addEventListener('click', this.backdropClickHandler, {capture: true, passive: false});
document.body.addEventListener('mousedown', this.backdropClickHandler, {capture: true, passive: false});
}
if (!this.escapeKeyHandler) {
@ -46,7 +46,7 @@ export default class ModalsService extends EPMModalsService {
}
removeEventHandlers() {
document.body.removeEventListener('click', this.backdropClickHandler, {capture: true, passive: false});
document.body.removeEventListener('mousedown', this.backdropClickHandler, {capture: true, passive: false});
this.backdropClickHandler = null;
document.removeEventListener('keydown', this.escapeKeyHandler, {capture: true, passive: false});