diff --git a/addons/website/static/src/components/wysiwyg_adapter/wysiwyg_adapter.js b/addons/website/static/src/components/wysiwyg_adapter/wysiwyg_adapter.js index 8c2a67a66f6..db28a8c0f74 100644 --- a/addons/website/static/src/components/wysiwyg_adapter/wysiwyg_adapter.js +++ b/addons/website/static/src/components/wysiwyg_adapter/wysiwyg_adapter.js @@ -610,10 +610,19 @@ export class WysiwygAdapterComponent extends ComponentAdapter { */ _onCancelRequest(event) { if (this._isDirty()) { + let discarding = false; this.dialogs.add(WebsiteDialog, { body: _t("If you discard the current edits, all unsaved changes will be lost. You can cancel to return to edit mode."), - primaryClick: () => this.props.quitCallback(), - secondaryClick: event.data.onReject, + primaryClick: () => { + discarding = true; + }, + }, { + onClose: () => { + if (discarding) { + return this.props.quitCallback(); + } + return event.data.onReject(); + } }); } else { return this.props.quitCallback();