From 5476a4c0edf896d6eb9c62bf54bd41a514a18d3b Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Fri, 10 Jan 2020 10:28:15 +0000 Subject: [PATCH] [FIX] web_editor: restore 'title' attribute on 'we' element Since a refactoring (it was working at some point), `title` attribute on `we` elements would be lost when rendering actual DOM elements. We had 2 occurences of `title` on `we` elements: 1. s_countdown > What Should Happ.. > Show Message > fa-eye icon has a title (in next version 13.2) 2. data-js `BackgroundPosition` (section) > fa-arrows has a title Also, incoming Cookies Bar task/PR will add a title on 'Hide For' option. closes odoo/odoo#43199 X-original-commit: 230a84edcea139bc7df44a4d1a27761e74038257 Signed-off-by: Quentin Smetz (qsm) --- addons/web_editor/static/src/js/editor/snippets.options.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index c199eaa40e3..86a3f70ac2b 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -21,14 +21,19 @@ var _t = core._t; * @returns {HTMLElement} - the original 'el' argument */ function _addTitleAndAllowedAttributes(el, title, options) { + let tooltipEl = el; if (title) { const titleEl = _buildTitleElement(title); + tooltipEl = titleEl; el.appendChild(titleEl); } if (options && options.classes) { el.classList.add(...options.classes); } + if (options && options.tooltip) { + tooltipEl.title = options.tooltip; + } if (options && options.dataAttributes) { for (const key in options.dataAttributes) { el.dataset[key] = options.dataAttributes[key]; @@ -1854,6 +1859,7 @@ const SnippetOptionWidget = Widget.extend({ options: { classes: el.classList, dataAttributes: el.dataset, + tooltip: el.title, childNodes: [...el.childNodes], }, };