diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 5376dc51341..351afe3e3d0 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -1173,10 +1173,14 @@ const Wysiwyg = Widget.extend({ !options.link.textContent.trim() && wysiwygUtils.isImg(this.lastElement)) { // If the link contains a media without text, the link is // editable in the media options instead. - this.snippetsMenu._mutex.exec(() => { + if (!options.noFocusUrl) { // Wait for the editor panel to be fully updated. - core.bus.trigger('activate_image_link_tool'); - }); + this.snippetsMenu._mutex.exec(() => { + // This is needed to focus the URL input when clicking + // on the "Edit link" of the popover. + core.bus.trigger('activate_image_link_tool'); + }); + } return; } if (options.forceOpen || !this.linkTools) { diff --git a/addons/website/static/tests/tours/link_tools.js b/addons/website/static/tests/tours/link_tools.js index 98d6d76c40c..211fab1ae4e 100644 --- a/addons/website/static/tests/tours/link_tools.js +++ b/addons/website/static/tests/tours/link_tools.js @@ -101,9 +101,13 @@ wTourUtils.registerWebsitePreviewTour('link_tools', { }, // 4. Add link on image. ...wTourUtils.clickOnEditAndWaitEditMode(), + wTourUtils.dragNDrop({ + id: 's_three_columns', + name: 'Columns', + }), { - content: "Click on image.", - trigger: 'iframe .s_text_image img', + content: "Click on the first image.", + trigger: 'iframe .s_three_columns .row > :nth-child(1) img', }, { content: "Activate link.", @@ -116,11 +120,16 @@ wTourUtils.registerWebsitePreviewTour('link_tools', { }, { content: "Deselect image.", - trigger: 'iframe .s_text_image p', + trigger: 'iframe .s_three_columns .row > :nth-child(2) img', }, { content: "Re-select image.", - trigger: 'iframe .s_text_image img', + trigger: 'iframe .s_three_columns .row > :nth-child(1) img', + }, + { + content: "Check that the second image is not within a link.", + trigger: 'iframe .s_three_columns .row > :nth-child(2) div > img', + run: () => {}, // It's a check. }, { content: "Check that link tools appear.", @@ -134,7 +143,7 @@ wTourUtils.registerWebsitePreviewTour('link_tools', { }, { content: "Check that image is not within a link anymore.", - trigger: 'iframe .s_text_image div > img', + trigger: 'iframe .s_three_columns .row > :nth-child(1) div > img', run: () => {}, // It's a check. }, // 6. Add mega menu with Cards template and edit URL on text-selected card.