[IMP] web_editor: prevent the colorpicker from closing on inner click

Before this commit, clicking in the area below the "Hex color" input
would close the color picker. This was annoying when entering a value in
the "Hex color" input and then clicking below to confirm it.

After this commit, the color picker no longer closes when clicking on
its background.

task-3747408

Part-of: odoo/odoo#157034
This commit is contained in:
Benjamin Vray
2024-04-03 14:29:08 +00:00
parent 4a05740bd3
commit d890ea8b8a
2 changed files with 10 additions and 1 deletions
@@ -1039,4 +1039,13 @@ export class ColorPalette extends Component {
this._updateGradient();
this._activateGradientSlider($(this.pickers['custom_gradient'].querySelector('.o_slider_multi input')));
}
/**
* @private
* @param {Event} ev
*/
_onColorpickerClick(ev) {
if (ev.target.matches(".o_colorpicker_section, .o_colorpicker_sections")) {
ev.stopPropagation();
}
}
}
@@ -60,7 +60,7 @@
</t>
<!-- options -->
<div t-name="web_editor.ColorPalette" class="colorpicker" t-ref="el">
<div t-name="web_editor.ColorPalette" class="colorpicker" t-ref="el" t-on-click="this._onColorpickerClick">
<div class="o_we_colorpicker_switch_panel d-flex justify-content-end px-2">
<t t-set="first_button_name"><t t-if="props.withCombinations">Theme</t><t t-else="">Solid</t></t>
<button type="button" tabindex="1" class="o_we_colorpicker_switch_pane_btn" t-attf-data-target="#{props.withCombinations ? 'color-combinations' : 'theme-colors'}"