diff --git a/addons/web_editor/static/src/js/wysiwyg/widgets/link_popover_widget.js b/addons/web_editor/static/src/js/wysiwyg/widgets/link_popover_widget.js index e0cefe2d649..cba0d63e66b 100644 --- a/addons/web_editor/static/src/js/wysiwyg/widgets/link_popover_widget.js +++ b/addons/web_editor/static/src/js/wysiwyg/widgets/link_popover_widget.js @@ -15,7 +15,7 @@ export class LinkPopoverWidget { } const popoverWidget = new this(params); params.wysiwyg?.odooEditor.observerUnactive('LinkPopoverWidget'); - popoverWidget.start(); + popoverWidget.start(); // This is not async params.wysiwyg?.odooEditor.observerActive('LinkPopoverWidget'); return popoverWidget; }; @@ -100,19 +100,13 @@ export class LinkPopoverWidget { container: this.container, }) .on('show.bs.popover.link_popover', () => { - this.wysiwyg.odooEditor.observerUnactive('show.bs.popover'); this._loadAsyncLinkPreview(); popoverShown = true; }) - .on('inserted.bs.popover', () => { - this.wysiwyg.odooEditor.observerActive('show.bs.popover'); - }) .on('hide.bs.popover.link_popover', () => { - this.wysiwyg.odooEditor.observerUnactive('hide.bs.popover'); popoverShown = false; }) .on('hidden.bs.popover.link_popover', () => { - this.wysiwyg.odooEditor.observerActive('hide.bs.popover'); for (const tooltip of tooltips) { tooltip.hide(); } @@ -123,7 +117,6 @@ export class LinkPopoverWidget { }) .popover('show'); - this.popover = Popover.getInstance(this.target); this.$target.on('mousedown.link_popover', (e) => { if (!popoverShown) { @@ -151,7 +144,7 @@ export class LinkPopoverWidget { this.popover.hide(); } } - } + }; $(document).on('mouseup.link_popover', onClickDocument); if (document !== this.wysiwyg.odooEditor.document) { $(this.wysiwyg.odooEditor.document).on('mouseup.link_popover', onClickDocument); diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 37f32a7b0c0..1c01c6b1356 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -446,7 +446,22 @@ export class Wysiwyg extends Component { }, filterMutationRecords: (records) => { return records.filter((record) => { + if (record.type === 'attributes' + && record.attributeName === 'aria-describedby') { + const value = (record.oldValue || record.target.getAttribute(record.attributeName)); + if (value && value.startsWith('popover')) { + // TODO maybe we should just always return false at + // this point: never considering the + // aria-describedby attribute for any tooltip? + const popoverData = Popover.getInstance(record.target); + return !popoverData + || popoverData.tip.id !== value + || !popoverData.tip.classList.contains('o_edit_menu_popover'); + } + } return !( + // TODO should probably not check o_header_standard + // here, since it is a website class ? (record.target.classList && record.target.classList.contains('o_header_standard')) || (record.type === 'attributes' && record.attributeName === 'data-last-history-steps') ); diff --git a/addons/website/static/tests/tours/link_tools.js b/addons/website/static/tests/tours/link_tools.js index 0b2cb319b3c..56de6387b5d 100644 --- a/addons/website/static/tests/tours/link_tools.js +++ b/addons/website/static/tests/tours/link_tools.js @@ -94,16 +94,6 @@ wTourUtils.registerWebsitePreviewTour('link_tools', { content: "The new link content should be odoo website and url odoo.be", trigger: '#toolbar:not(.oe-floating) .dropdown:has([name="link_style_color"]) > button', }, - { - // When doing automated testing, the link popover takes time to - // hide. While hidding, the editor observer is unactive in order to - // prevent the popover mutation to be recorded. In a manual - // scenario, the popover has plenty of time to be hidden and the - // obsever would be re-activated in time. As this problem arise only - // in test, we make sure the popover is hidden - trigger: 'iframe html:not(:has(.popover))', - run: () => null, // it's a check - }, { content: "Click on the secondary style button.", trigger: '#toolbar:not(.oe-floating) we-button[data-value="secondary"]',