From 9453d564e15f03da7c181b03c1edcc09916be5b9 Mon Sep 17 00:00:00 2001 From: Benjamin Willig Date: Tue, 1 Oct 2024 14:55:45 +0200 Subject: [PATCH 1/2] [FIX] web_field_tooltip: set max width for the tooltip to prevent weird behaviors where a tooltip could be placed outside the window when its a content was a long text --- .../static/src/components/field_tooltip/field_tooltip.esm.js | 1 - .../static/src/components/field_tooltip/field_tooltip.scss | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.esm.js b/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.esm.js index f6eb184bc437..176fa977d6d1 100644 --- a/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.esm.js +++ b/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.esm.js @@ -66,7 +66,6 @@ export class FieldTooltip extends Component { { closeOnClickAway: true, position: "top", - title: "title", } ); } diff --git a/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.scss b/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.scss index 0eb4788d24c4..6eedec047c9e 100644 --- a/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.scss +++ b/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.scss @@ -18,6 +18,7 @@ sup.field-tooltip { .popup-div { min-width: 100px; + max-width: 400px; min-height: 30px; > * { From d51928a4f1a52dd4dff65987446ac218dea54802 Mon Sep 17 00:00:00 2001 From: Benjamin Willig Date: Mon, 7 Oct 2024 17:35:47 +0200 Subject: [PATCH 2/2] [FIX] web_field_tooltip: fixed popup colors when using odoo dark mode --- .../src/components/field_tooltip/field_tooltip.esm.js | 4 +++- .../src/components/field_tooltip/field_tooltip.scss | 11 +++++++++++ .../src/components/field_tooltip/field_tooltip.xml | 4 +++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.esm.js b/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.esm.js index 176fa977d6d1..25f804967edc 100644 --- a/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.esm.js +++ b/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.esm.js @@ -19,7 +19,8 @@ export class FieldTooltip extends Component { this.showAddHelper = session.can_manage_tooltips && session.tooltip_show_add_helper; this.fieldTooltip = this.props.field.field_tooltip; - + this.colorMode = + this.env.services.cookie.current.color_scheme === "dark" ? "dark" : "light"; if (session.can_manage_tooltips) { this.dialogService = useService("dialog"); } @@ -30,6 +31,7 @@ export class FieldTooltip extends Component { return { title: props.field.string, help: markup(this.tooltipText), + colorMode: this.colorMode, }; } diff --git a/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.scss b/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.scss index 6eedec047c9e..dea2a00ce340 100644 --- a/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.scss +++ b/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.scss @@ -33,4 +33,15 @@ sup.field-tooltip { .popover-content { background-color: white; } + + &.popup-dark-mode { + .popover-title { + font-weight: bold; + background-color: #242733; + } + + .popover-content { + background-color: unset; + } + } } diff --git a/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.xml b/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.xml index 4ab68c328e98..47eae35d3279 100644 --- a/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.xml +++ b/web_field_tooltip/static/src/components/field_tooltip/field_tooltip.xml @@ -16,7 +16,9 @@ -