From 3490b998eec7d876c09d9a4c9a4bae83df052b86 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 30 Dec 2021 11:35:18 +0000 Subject: [PATCH] [FIX] web, *: fix the grab cursor not working on all browsers *: web_editor, point_of_sale, pos_restaurant The grab cursor is currently not working on all browsers (at least Chrome Linux). The fallback rule does not even work, meaning that if you type: ``` cursor: move; cursor: grab; ``` Those browsers does not even use "move" as they see "grab" as valid but use the "default" cursor. This commit replaces our "grab" uses with a local cursor ensuring it works. Related to task-2431469 closes odoo/odoo#82093 X-original-commit: 23ebcca902781f2fa0f2381997be4f3d375385b5 Related: odoo/enterprise#23193 Signed-off-by: Quentin Smetz (qsm) Signed-off-by: Romain Derie (rde) --- addons/point_of_sale/static/src/css/pos.css | 8 ++------ .../pos_restaurant/static/src/css/restaurant.css | 5 +++-- addons/web/static/src/img/openhand.cur | Bin 0 -> 326 bytes .../web/static/src/legacy/scss/data_export.scss | 2 +- addons/web/static/src/legacy/scss/fields.scss | 2 +- addons/web/static/src/legacy/scss/utils.scss | 10 ++++++++++ .../static/src/scss/wysiwyg_snippets.scss | 7 ++----- 7 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 addons/web/static/src/img/openhand.cur diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css index 2103f69fb9e..1f8aa667dac 100644 --- a/addons/point_of_sale/static/src/css/pos.css +++ b/addons/point_of_sale/static/src/css/pos.css @@ -2851,16 +2851,12 @@ td { } .drag-handle { - cursor: move; /* fallback if grab cursor is unsupported */ - cursor: grab; - cursor: -moz-grab; - cursor: -webkit-grab; + /* See o-grab-cursor mixin */ + cursor: url(/web/static/src/img/openhand.cur), grab; } .drag-handle:active { cursor: grabbing; - cursor: -moz-grabbing; - cursor: -webkit-grabbing; } diff --git a/addons/pos_restaurant/static/src/css/restaurant.css b/addons/pos_restaurant/static/src/css/restaurant.css index b9ed6005664..a99beb01c0e 100644 --- a/addons/pos_restaurant/static/src/css/restaurant.css +++ b/addons/pos_restaurant/static/src/css/restaurant.css @@ -13,7 +13,7 @@ /* ------ FLOOR SELECTOR ------- */ -.floor-selector { +.floor-selector { line-height: 48px; font-size: 18px; display: -webkit-flex; @@ -222,7 +222,8 @@ border-radius: 24px; background: white; box-shadow: 0px 2px 3px rgba(0,0,0,0.2); - cursor: grab; + /* See o-grab-cursor mixin */ + cursor: url(/web/static/src/img/openhand.cur), grab; transition: all 150ms linear; z-index: 100; transform: translate(-50%, -50%); diff --git a/addons/web/static/src/img/openhand.cur b/addons/web/static/src/img/openhand.cur new file mode 100644 index 0000000000000000000000000000000000000000..fba3ddc807fd2e29b41d09af0b14d6db6bdb879c GIT binary patch literal 326 zcmbu(u?@m75QX92i6U1h9TF8ODcJzFVFXGt0;3=b>Wq?t0aBq9D39kj1vQ-Y*=OHL zXDA3XO+ln$A7Bmatg)j7uQ`?@la<+x_h6sG+m?*Z%Tfs literal 0 HcmV?d00001 diff --git a/addons/web/static/src/legacy/scss/data_export.scss b/addons/web/static/src/legacy/scss/data_export.scss index 45d25a5bea5..60f1e3dcab4 100644 --- a/addons/web/static/src/legacy/scss/data_export.scss +++ b/addons/web/static/src/legacy/scss/data_export.scss @@ -37,7 +37,7 @@ flex: 1; overflow: auto; .o_short_field { - cursor: grab; + @include o-grab-cursor; } .o-field-placeholder { border: 1px dashed $o-brand-primary; diff --git a/addons/web/static/src/legacy/scss/fields.scss b/addons/web/static/src/legacy/scss/fields.scss index b66b5ddbdad..af1b3da3564 100644 --- a/addons/web/static/src/legacy/scss/fields.scss +++ b/addons/web/static/src/legacy/scss/fields.scss @@ -367,7 +367,7 @@ // Handle widget &.o_row_handle { - cursor: grab; + @include o-grab-cursor; color: #adb5bd; text-align: center; width: 100%; diff --git a/addons/web/static/src/legacy/scss/utils.scss b/addons/web/static/src/legacy/scss/utils.scss index f5e10117abc..5ecf655119f 100644 --- a/addons/web/static/src/legacy/scss/utils.scss +++ b/addons/web/static/src/legacy/scss/utils.scss @@ -166,6 +166,16 @@ border-top: $caret-width solid transparent; } +//------------------------------------------------------------------- +// Cursor +//------------------------------------------------------------------- + +@mixin o-grab-cursor() { + // Use a custom cursor for the open hand icon as "grab" is not properly + // working on Chrome Linux (at least) + cursor: url(/web/static/src/img/openhand.cur), grab; +} + // ------------------------------------------------------------------ // Hovering effects // ------------------------------------------------------------------ diff --git a/addons/web_editor/static/src/scss/wysiwyg_snippets.scss b/addons/web_editor/static/src/scss/wysiwyg_snippets.scss index b3d6769aa57..61215ca3943 100644 --- a/addons/web_editor/static/src/scss/wysiwyg_snippets.scss +++ b/addons/web_editor/static/src/scss/wysiwyg_snippets.scss @@ -371,10 +371,7 @@ body.editor_enable.editor_has_snippets { border-left: $o-we-sidebar-blocks-content-snippet-spacing solid transparent; margin-bottom: $o-we-sidebar-blocks-content-snippet-spacing; user-select: none; - - cursor: pointer; - cursor: copy; - cursor: grab; + @include o-grab-cursor; .oe_snippet_thumbnail_title { display: block; @@ -2143,7 +2140,7 @@ body.editor_enable.editor_has_snippets { pointer-events: auto; .o_we_overlay_content { - cursor: grab; + @include o-grab-cursor; .o_we_grabbing { cursor: grabbing;