From 20633972e9b56bdc102357129e74df30a95cefa9 Mon Sep 17 00:00:00 2001 From: undergroundwires Date: Fri, 15 Dec 2023 08:00:46 +0100 Subject: [PATCH] Fix touch-enabled Chromium highlight on tree nodes This commit resolves issues with the touch highlight behavior on tree nodes in touch-enabled Chromium browsers (such as Google Chrome). The fix addresses two issues: 1. Dual color transition issue during tapping actions on tree nodes. 2. Not highlighting full visible width of the node on keyboard focus. Other changes include: - Create `InteractableNode.vue` to centralize click styling and logic. - Remove redundant click/hover/touch styling from `LeafTreeNode.vue` and `HierarchicalTreeNode.vue`. --- src/presentation/assets/styles/_mixins.scss | 28 +++---- .../TreeView/Node/HierarchicalTreeNode.vue | 29 +++---- .../Tree/TreeView/Node/InteractableNode.vue | 83 +++++++++++++++++++ .../View/Tree/TreeView/Node/LeafTreeNode.vue | 79 +++++------------- 4 files changed, 132 insertions(+), 87 deletions(-) create mode 100644 src/presentation/components/Scripts/View/Tree/TreeView/Node/InteractableNode.vue diff --git a/src/presentation/assets/styles/_mixins.scss b/src/presentation/assets/styles/_mixins.scss index 7af67c66..b4695dbf 100644 --- a/src/presentation/assets/styles/_mixins.scss +++ b/src/presentation/assets/styles/_mixins.scss @@ -1,34 +1,34 @@ @mixin hover-or-touch($selector-suffix: '', $selector-prefix: '&') { @media (hover: hover) { - - /* We only do this if hover is truly supported; otherwise the emulator in mobile - keeps hovered style in-place even after touching, making it sticky. */ + /* + Only apply hover styles if the device truly supports hover; otherwise the + emulator in mobile keeps hovered style in-place even after touching, making it sticky. + */ #{$selector-prefix}:hover #{$selector-suffix} { @content; } } @media (hover: none) { - - /* We only do this if hover is not supported,otherwise the desktop behavior is not - as desired; it does not get activated on hover but only during click/touch. */ + /* + Apply active styles on touch or click, ensuring interactive feedback on devices without hover capability. + */ #{$selector-prefix}:active #{$selector-suffix} { @content; } } } +/* + This mixin removes the default blue tap highlight seen in mobile WebKit browsers (e.g., Chrome, Safari, Edge). + The mixin by itself may reduce accessibility by hiding this interactive cue. Therefore, it is recommended + to use this mixin in conjunction with the `hover-or-touch` mixin to provide necessary visual feedback + for interactive elements during hover or touch interactions. +*/ @mixin clickable($cursor: 'pointer') { cursor: #{$cursor}; user-select: none; - /* - It removes (blue) background during touch as seen in mobile webkit browsers (Chrome, Safari, Edge). - The default behavior is that any element (or containing element) that has cursor:pointer - explicitly set and is clicked will flash blue momentarily. - Removing it could have accessibility issue since that hides an interactive cue. But as we still provide - response to user actions through :active by `hover-or-touch` mixin. - */ - -webkit-tap-highlight-color: transparent; + -webkit-tap-highlight-color: transparent; // Removes blue tap highlight } @mixin fade-transition($name) { diff --git a/src/presentation/components/Scripts/View/Tree/TreeView/Node/HierarchicalTreeNode.vue b/src/presentation/components/Scripts/View/Tree/TreeView/Node/HierarchicalTreeNode.vue index 71c4a2c5..8abbeaa0 100644 --- a/src/presentation/components/Scripts/View/Tree/TreeView/Node/HierarchicalTreeNode.vue +++ b/src/presentation/components/Scripts/View/Tree/TreeView/Node/HierarchicalTreeNode.vue @@ -1,15 +1,17 @@