From feb4b8c2ad18be41f4908a0c64e284fbc375c930 Mon Sep 17 00:00:00 2001 From: "stefanorigano (SRI)" Date: Mon, 10 Oct 2022 15:20:07 +0000 Subject: [PATCH] [FIX] web: `ListRenderer` hover & focus states Since Bootstrap 5.1 cell background color is controlled by CSS variables in order to effectively handle mixed scenarios (eg. "selected + :hover + table-info" combined). Commit https://github.com/odoo/odoo/commit/1d4145dfda1f8a95c3f386ae01fb0e29ddd4be48 forced bg-colors for :hover and :focus states, achieving the desired result in a simple scenario but inadvertently breaking the behavior for complex combination and/or different color schemes (eg. dark-mode). This commit restore the default BS mechanics for `:hover`, and uses BS variables to handle `:focus`. task-3012970 closes odoo/odoo#103118 X-original-commit: 1978a5bfa08a534487d7a70921105f8b5c3a5d30 Related: odoo/enterprise#32740 Signed-off-by: Pierre Paridans (app) --- addons/web/static/src/scss/bootstrap_overridden.scss | 2 +- addons/web/static/src/views/list/list_renderer.scss | 12 +++++------- addons/web/static/src/views/list/list_renderer.xml | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/addons/web/static/src/scss/bootstrap_overridden.scss b/addons/web/static/src/scss/bootstrap_overridden.scss index d22555dd0e3..29ed9a31a16 100644 --- a/addons/web/static/src/scss/bootstrap_overridden.scss +++ b/addons/web/static/src/scss/bootstrap_overridden.scss @@ -139,7 +139,7 @@ $headings-color: $o-main-headings-color !default; $table-striped-color: inherit !default; $table-striped-bg-factor: .01 !default; -$table-hover-bg-factor: .075 !default; +$table-hover-bg-factor: .055 !default; $table-border-color: $gray-200 !default; $table-group-separator-color: $gray-200 !default; $table-cell-padding-x: .75rem !default; diff --git a/addons/web/static/src/views/list/list_renderer.scss b/addons/web/static/src/views/list/list_renderer.scss index f6023f59963..239ee06e4d7 100644 --- a/addons/web/static/src/views/list/list_renderer.scss +++ b/addons/web/static/src/views/list/list_renderer.scss @@ -394,13 +394,11 @@ // 1. we set the global separator (gray line) of the table on the row (bottom) and not on the cell (bottom) .o_data_row { border-bottom-width: 1px; - &:not(.o_selected_row) { - &:focus-within { - background-color: lighten($o-form-lightsecondary, 10%); - } - &:hover { - background-color: lighten($o-form-lightsecondary, 16%); - } + + &:not(.o_selected_row):not(.o_data_row_selected):focus-within > * { + $-focus-bg: mix($table-color, $table-bg, percentage($table-hover-bg-factor + 0.1)); + + --#{$variable-prefix}table-accent-bg: #{$-focus-bg}; } } diff --git a/addons/web/static/src/views/list/list_renderer.xml b/addons/web/static/src/views/list/list_renderer.xml index 5526dd16f78..7cae6da0396 100644 --- a/addons/web/static/src/views/list/list_renderer.xml +++ b/addons/web/static/src/views/list/list_renderer.xml @@ -12,7 +12,7 @@ - +