summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Derie <rde@odoo.com>2020-01-10 10:28:15 +0000
committerRomain Derie <rde@odoo.com>2020-01-13 12:05:27 +0000
commit5476a4c0edf896d6eb9c62bf54bd41a514a18d3b (patch)
tree582c83ce4400f33acc4b6a43307b84c6fd75ce19
parent39c00a28df1dad4a4b02653c66a2f72d9cc55e06 (diff)
[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) <qsm@odoo.com>
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.options.js6
1 files changed, 6 insertions, 0 deletions
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],
},
};