From 338b4cb2e70950c1cd4795d0dbb79eca9567f18d Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 8 Nov 2019 08:17:45 -0800 Subject: [PATCH] Prevent workboard cards from being grabbed by the "Txxx" object name text Summary: Fixes T13452. We currently give users mixed signals about the interaction mode of this text: the cursor says "text" but the behavior is "grab". Make the behavior "text" to align with the cursor. An alternate variation of this change is to remove the cursor, but this is preferable if it doesn't cause problems, since copying the task ID is at least somewhat useful. Test Plan: In Safari, Firefox, and Chrome: selected and copied object names from workboard cards; and dragged workboard cards by other parts of their UI. Maniphest Tasks: T13452 Differential Revision: https://secure.phabricator.com/D20898 --- resources/celerity/map.php | 22 +++++++++++----------- src/view/phui/PHUIObjectItemView.php | 3 ++- webroot/rsrc/js/core/DraggableList.js | 9 +++++++++ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 8547f8a0a3..ffe4024ed7 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -10,7 +10,7 @@ return array( 'conpherence.pkg.css' => '3c8a0668', 'conpherence.pkg.js' => '020aebcf', 'core.pkg.css' => '77de226f', - 'core.pkg.js' => '6e5c894f', + 'core.pkg.js' => '705aec2c', 'differential.pkg.css' => '607c84be', 'differential.pkg.js' => '1b97518d', 'diffusion.pkg.css' => '42c75c37', @@ -448,7 +448,7 @@ return array( 'rsrc/js/application/uiexample/notification-example.js' => '29819b75', 'rsrc/js/core/Busy.js' => '5202e831', 'rsrc/js/core/DragAndDropFileUpload.js' => '4370900d', - 'rsrc/js/core/DraggableList.js' => 'c9ad6f70', + 'rsrc/js/core/DraggableList.js' => '0169e425', 'rsrc/js/core/Favicon.js' => '7930776a', 'rsrc/js/core/FileUpload.js' => 'ab85e184', 'rsrc/js/core/Hovercard.js' => '074f0783', @@ -777,7 +777,7 @@ return array( 'phabricator-diff-changeset-list' => '0f5c016d', 'phabricator-diff-inline' => 'a4a14a94', 'phabricator-drag-and-drop-file-upload' => '4370900d', - 'phabricator-draggable-list' => 'c9ad6f70', + 'phabricator-draggable-list' => '0169e425', 'phabricator-fatal-config-template-css' => '20babf50', 'phabricator-favicon' => '7930776a', 'phabricator-feed-css' => 'd8b6e3f8', @@ -920,6 +920,14 @@ return array( 'javelin-uri', 'phabricator-notification', ), + '0169e425' => array( + 'javelin-install', + 'javelin-dom', + 'javelin-stratcom', + 'javelin-util', + 'javelin-vector', + 'javelin-magical-init', + ), '022516b4' => array( 'javelin-install', 'javelin-util', @@ -2032,14 +2040,6 @@ return array( 'javelin-util', 'phabricator-keyboard-shortcut-manager', ), - 'c9ad6f70' => array( - 'javelin-install', - 'javelin-dom', - 'javelin-stratcom', - 'javelin-util', - 'javelin-vector', - 'javelin-magical-init', - ), 'cf32921f' => array( 'javelin-behavior', 'javelin-dom', diff --git a/src/view/phui/PHUIObjectItemView.php b/src/view/phui/PHUIObjectItemView.php index 05747c7ce6..b5ad5a7fd6 100644 --- a/src/view/phui/PHUIObjectItemView.php +++ b/src/view/phui/PHUIObjectItemView.php @@ -379,10 +379,11 @@ final class PHUIObjectItemView extends AphrontTagView { if ($this->objectName) { $header_name[] = array( - phutil_tag( + javelin_tag( 'span', array( 'class' => 'phui-oi-objname', + 'sigil' => 'ungrabbable', ), $this->objectName), ' ', diff --git a/webroot/rsrc/js/core/DraggableList.js b/webroot/rsrc/js/core/DraggableList.js index 5f19b7061d..8930f43f94 100644 --- a/webroot/rsrc/js/core/DraggableList.js +++ b/webroot/rsrc/js/core/DraggableList.js @@ -181,6 +181,15 @@ JX.install('DraggableList', { return; } + // See T13452. If this is an ungrabble part of the item, don't start a + // drag. We use this to allow users to select text on cards. + var target = e.getTarget(); + if (target) { + if (JX.Stratcom.hasSigil(target, 'ungrabbable')) { + return; + } + } + if (JX.Stratcom.pass()) { // Let other handlers deal with this event before we do. return; -- 2.51.2