diff --git a/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js b/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js index 9eb0a0ac565..bd1ed80becd 100644 --- a/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js +++ b/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js @@ -1445,7 +1445,14 @@ export class OdooEditor extends EventTarget { if (hasGradient && !hasTextGradientClass) { hiliteColor = backgroundImage; } else { - hiliteColor = computedStyle.backgroundColor; + let ancestor = endContainer; + while (ancestor && !hiliteColor) { + hiliteColor = ancestor.style.backgroundColor; + ancestor = ancestor.parentElement; + } + if (!hiliteColor) { + hiliteColor = computedStyle.backgroundColor; + } } } }