From f981c5f8f09ff884f0e134ae8d4ee0ad5f56e3f4 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Wed, 3 Aug 2022 16:38:03 +0000 Subject: [PATCH] [IMP] web: FormView: field tooltips UX - Less Overwhelming: reduces the hover zone to an icon. Tooltip appearances are less intrusive as you move the mouse in the screen - More discoverable: show an icon for the fields that have a tooltip - better UX: max-width on the popup closes odoo/odoo#97440 Note: commit 3363e55cac reduced help messages to useful ones. Signed-off-by: Aaron Bohy (aab) --- addons/web/static/src/core/tooltip/tooltip.scss | 1 + .../web/static/src/views/fields/field_tooltip.xml | 4 ---- addons/web/static/src/views/form/form_label.js | 13 ++++++++++--- .../web/static/tests/views/form/form_view_tests.js | 14 +++++++------- addons/web/static/tests/views/list_view_tests.js | 4 ++-- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/addons/web/static/src/core/tooltip/tooltip.scss b/addons/web/static/src/core/tooltip/tooltip.scss index faacce47bf4..c43145ebe31 100644 --- a/addons/web/static/src/core/tooltip/tooltip.scss +++ b/addons/web/static/src/core/tooltip/tooltip.scss @@ -1,5 +1,6 @@ .o-tooltip { font-size: small; + max-width: 400px; .o-tooltip--string { background-color: $o-tooltip-title-background-color; diff --git a/addons/web/static/src/views/fields/field_tooltip.xml b/addons/web/static/src/views/fields/field_tooltip.xml index 89fc7fe0e9b..1bdfa8b1871 100644 --- a/addons/web/static/src/views/fields/field_tooltip.xml +++ b/addons/web/static/src/views/fields/field_tooltip.xml @@ -3,10 +3,6 @@ - - diff --git a/addons/web/static/src/views/form/form_label.js b/addons/web/static/src/views/form/form_label.js index 4cd7b6b605e..ea79db9e04d 100644 --- a/addons/web/static/src/views/form/form_label.js +++ b/addons/web/static/src/views/form/form_label.js @@ -24,7 +24,7 @@ export class FormLabel extends Component { return classes.join(" "); } - get hasBigTooltip() { + get hasTooltip() { return Boolean(odoo.debug) || this.tooltipHelp; } @@ -37,6 +37,13 @@ export class FormLabel extends Component { return help; } get tooltipInfo() { + if (!odoo.debug) { + return JSON.stringify({ + field: { + help: this.tooltipHelp, + }, + }); + } return getTooltipInfo({ viewMode: "form", resModel: this.props.record.resModel, @@ -47,7 +54,7 @@ export class FormLabel extends Component { } } FormLabel.template = xml` -