diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index add61a34f1e..8dd7b67cdbd 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -2749,9 +2749,10 @@ export class Wysiwyg extends Component { } } _onSelectionChange() { - if (this.odooEditor.autohideToolbar) { - const isVisible = this.linkPopover && this.linkPopover.el.offsetParent; - if (isVisible && !this.odooEditor.document.getSelection().isCollapsed) { + if (this.odooEditor.autohideToolbar && this.linkPopover) { + const selectionInLink = getInSelection(this.odooEditor.document, 'a') === this.linkPopover.target; + const isVisible = this.linkPopover.el.offsetParent; + if (isVisible && !selectionInLink) { this.linkPopover.hide(); } }