diff --git a/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js b/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js index 2b43c5a17bd..7a42d2b92d1 100644 --- a/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js +++ b/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js @@ -269,21 +269,6 @@ export class AttachmentViewer extends Component { // Handlers //-------------------------------------------------------------------------- - /** - * Called when clicking on mask of attachment viewer. - * - * @private - * @param {MouseEvent} ev - */ - _onClick(ev) { - if (this.attachmentViewer.isDragging) { - return; - } - // TODO: clicking on the background should probably be handled by the dialog? - // task-2092965 - this.attachmentViewer.close(); - } - /** * Called when clicking on cross icon. * diff --git a/addons/mail/static/src/components/attachment_viewer/attachment_viewer.xml b/addons/mail/static/src/components/attachment_viewer/attachment_viewer.xml index 2a96b8e42c2..f7561bd5195 100644 --- a/addons/mail/static/src/components/attachment_viewer/attachment_viewer.xml +++ b/addons/mail/static/src/components/attachment_viewer/attachment_viewer.xml @@ -3,7 +3,7 @@ -
+
diff --git a/addons/mail/static/src/models/attachment_viewer.js b/addons/mail/static/src/models/attachment_viewer.js index 9123e61b594..9f7c815cc2b 100644 --- a/addons/mail/static/src/models/attachment_viewer.js +++ b/addons/mail/static/src/models/attachment_viewer.js @@ -22,6 +22,19 @@ registerModel({ containsElement(element) { return Boolean(this.component && this.component.root.el && this.component.root.el.contains(element)); }, + /** + * Called when clicking on mask of attachment viewer. + * + * @param {MouseEvent} ev + */ + onClick(ev) { + if (this.isDragging) { + return; + } + // TODO: clicking on the background should probably be handled by the dialog? + // task-2092965 + this.close(); + }, /** * @private * @returns {string}