[FIX] web_editor: reduce clickable area of checkboxes in editor panel

Before this commit the clickable zone of a checkbox in the editor was
all the width of the panel.

After this commit, the clickable zone is only the label width + the
checkbox width. Also, the active and hover states of the label have been
removed to not confuse the user.

task-2312878

closes odoo/odoo#59406

X-original-commit: 61ffe97d03deae0aee72568311c453d1cd3470c8
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
qsm-odoo
2020-10-07 12:10:31 +00:00
parent 4b90cb958e
commit cfd63a2b35
3 changed files with 26 additions and 5 deletions
@@ -705,6 +705,21 @@ const CheckboxUserValueWidget = ButtonUserValueWidget.extend({
return this._super(...arguments);
},
//--------------------------------------------------------------------------
// Handlers
//--------------------------------------------------------------------------
/**
* @override
*/
_onButtonClick(ev) {
if (!ev.target.closest('we-title, we-checkbox')) {
// Only consider clicks on the label and the checkbox control itself
return;
}
return this._super(...arguments);
},
});
const BaseSelectionUserValueWidget = UserValueWidget.extend({
@@ -671,13 +671,16 @@ body.editor_enable.editor_has_snippets {
padding: 0;
border: none;
background: none;
cursor: default;
> we-title {
cursor: pointer;
}
> div {
display: flex;
min-height: $o-we-sidebar-content-field-height;
line-height: $o-we-sidebar-content-field-height;
}
we-checkbox {
flex: 0 0 auto;
display: flex;
@@ -686,6 +689,7 @@ body.editor_enable.editor_has_snippets {
height: $o-we-sidebar-content-field-toggle-height;
background-color: $o-we-sidebar-content-field-toggle-bg;
border-radius: 10rem;
cursor: pointer;
&::after {
content: "";
@@ -697,11 +701,13 @@ body.editor_enable.editor_has_snippets {
box-shadow: $o-we-sidebar-content-field-toggle-control-shadow;
}
}
&.active we-checkbox {
background-color: $o-we-sidebar-content-field-toggle-active-bg;
justify-content: flex-end;
}
&.active, &:hover {
color: $o-we-sidebar-content-field-clickable-color;
}
}
// Selection (select and button groups)
@@ -43,14 +43,14 @@ odoo.define('website_form_editor.tour', function (require) {
testText += '.s_website_form_required';
ret.push({
content: "Mark the field as required",
trigger: 'we-button[data-name="required_opt"]',
trigger: 'we-button[data-name="required_opt"] we-checkbox',
});
}
if (hidden) {
testText += '.s_website_form_field_hidden';
ret.push({
content: "Mark the field as hidden",
trigger: 'we-button[data-name="hidden_opt"]',
trigger: 'we-button[data-name="hidden_opt"] we-checkbox',
});
}
if (label) {
@@ -176,7 +176,7 @@ odoo.define('website_form_editor.tour', function (require) {
run: 'text Management Service',
}, {
content: "Mark the field as not required",
trigger: 'we-button[data-name="required_opt"]',
trigger: 'we-button[data-name="required_opt"] we-checkbox',
}, {
content: "Check the resulting field",
trigger: ".s_website_form_field.s_website_form_custom:not(.s_website_form_required)" +