From 9d52caf19a28eb824b5e2e292b20256566950cfa Mon Sep 17 00:00:00 2001 From: Benjamin Kausch Date: Tue, 15 Apr 2025 19:26:30 +0200 Subject: [PATCH] Disable opening of hovercard if trigger node is inside hovercard Summary: If the content of a hovercard contains another hovercard trigger, the initial hovercard will be closed when entering the inside trigger with the mouse. You can see the bug with every differential hovercard which contains reviewers. But there are other cases too: For example if project descriptions use mentions or other project tags. This fix is pretty easy and returns inside the mousemove handler if the trigger node has a closest ancestor with the class "jx-hovercard-container". Closes T16029 Test Plan: See if a hovercard is closed if you enter following inside the hovercard: - reviewers inside differential hovercard - people mentions or other project tags inside project hovercard Reviewers: O1 Blessed Committers, aklapper Reviewed By: O1 Blessed Committers, aklapper Subscribers: aklapper, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T16029 Differential Revision: https://we.phorge.it/D25965 --- resources/celerity/map.php | 22 +++++++++++----------- webroot/rsrc/js/core/behavior-hovercard.js | 5 ++++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index beb76af95c..d751dc01c7 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -10,7 +10,7 @@ return array( 'conpherence.pkg.css' => '3144a5e2', 'conpherence.pkg.js' => '020aebcf', 'core.pkg.css' => '10815c8e', - 'core.pkg.js' => 'f58c3c6e', + 'core.pkg.js' => '813d8cbd', 'dark-console.pkg.js' => '187792c2', 'differential.pkg.css' => '91ac6214', 'differential.pkg.js' => '46fcb3af', @@ -480,7 +480,7 @@ return array( 'rsrc/js/core/behavior-global-drag-and-drop.js' => '1cab0e9a', 'rsrc/js/core/behavior-high-security-warning.js' => 'dae2d55b', 'rsrc/js/core/behavior-history-install.js' => '6a1583a8', - 'rsrc/js/core/behavior-hovercard.js' => '183738e6', + 'rsrc/js/core/behavior-hovercard.js' => '0a4b35f2', 'rsrc/js/core/behavior-keyboard-pager.js' => '1325b731', 'rsrc/js/core/behavior-keyboard-shortcuts.js' => '42c44e8b', 'rsrc/js/core/behavior-lightbox-attachments.js' => '14c7ab36', @@ -665,7 +665,7 @@ return array( 'javelin-behavior-pholio-mock-view' => '5aa1544e', 'javelin-behavior-phui-dropdown-menu' => '5cf0501a', 'javelin-behavior-phui-file-upload' => 'e150bd50', - 'javelin-behavior-phui-hovercards' => '183738e6', + 'javelin-behavior-phui-hovercards' => '0a4b35f2', 'javelin-behavior-phui-selectable-list' => 'b26a41e4', 'javelin-behavior-phui-submenu' => 'b5e9bff9', 'javelin-behavior-phui-tab-group' => '242aa08b', @@ -991,6 +991,14 @@ return array( 'herald-rule-editor', 'javelin-behavior', ), + '0a4b35f2' => array( + 'javelin-behavior', + 'javelin-behavior-device', + 'javelin-stratcom', + 'javelin-vector', + 'phui-hovercard', + 'phui-hovercard-list', + ), '0ad8d31f' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1041,14 +1049,6 @@ return array( 'phuix-icon-view', 'phabricator-busy', ), - '183738e6' => array( - 'javelin-behavior', - 'javelin-behavior-device', - 'javelin-stratcom', - 'javelin-vector', - 'phui-hovercard', - 'phui-hovercard-list', - ), '194e8160' => array( 'aphront-typeahead-control-css', 'phui-tag-view-css', diff --git a/webroot/rsrc/js/core/behavior-hovercard.js b/webroot/rsrc/js/core/behavior-hovercard.js index d0b2058166..a4bee08257 100644 --- a/webroot/rsrc/js/core/behavior-hovercard.js +++ b/webroot/rsrc/js/core/behavior-hovercard.js @@ -32,8 +32,11 @@ JX.behavior('phui-hovercards', function(config, statics) { } var node = e.getNode('hovercard'); - var data = e.getNodeData('hovercard').hovercardSpec; + if (node.closest('.jx-hovercard-container')) { + return; + } + var data = e.getNodeData('hovercard').hovercardSpec; var card = cards.getCard(data); cards.drawCard(card, node);