From 7ab970d1a7d347d2d318f9cedbe11ac75addfa3a Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 16 Jan 2016 15:36:45 -0800 Subject: [PATCH] Eat right-click, etc., on autocomplete suggestion menu Summary: Ref T10163. If you right-click the suggestion menu, just eat it. I don't think we can really choose a different behavior reasonably, or that users have any reason to do this. I'm leaving "clicking the header dismisses it", I think that behavior is fine and reasonable. Test Plan: Control-clicked a suggestion menu, didn't trigger a suggestion. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10163 Differential Revision: https://secure.phabricator.com/D15042 --- resources/celerity/map.php | 16 ++++++++-------- webroot/rsrc/js/phuix/PHUIXAutocomplete.js | 8 ++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index a41af25a7e..97150f6c74 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -507,7 +507,7 @@ return array( 'rsrc/js/phui/behavior-phui-object-box-tabs.js' => '2bfa2836', 'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8', 'rsrc/js/phuix/PHUIXActionView.js' => '8cf6d262', - 'rsrc/js/phuix/PHUIXAutocomplete.js' => 'fc10c813', + 'rsrc/js/phuix/PHUIXAutocomplete.js' => '21dc9144', 'rsrc/js/phuix/PHUIXDropdownMenu.js' => 'bd4c8dca', 'rsrc/js/phuix/PHUIXFormControl.js' => '8fba1997', 'rsrc/js/phuix/PHUIXIconView.js' => 'bff6884b', @@ -836,7 +836,7 @@ return array( 'phui-workpanel-view-css' => 'adec7699', 'phuix-action-list-view' => 'b5c256b8', 'phuix-action-view' => '8cf6d262', - 'phuix-autocomplete' => 'fc10c813', + 'phuix-autocomplete' => '21dc9144', 'phuix-dropdown-menu' => 'bd4c8dca', 'phuix-form-control-view' => '8fba1997', 'phuix-icon-view' => 'bff6884b', @@ -1004,6 +1004,12 @@ return array( 'javelin-stratcom', 'conpherence-thread-manager', ), + '21dc9144' => array( + 'javelin-install', + 'javelin-dom', + 'phuix-icon-view', + 'phabricator-prefab', + ), '2290aeef' => array( 'javelin-install', 'javelin-dom', @@ -2086,12 +2092,6 @@ return array( 'javelin-behavior-device', 'phabricator-keyboard-shortcut', ), - 'fc10c813' => array( - 'javelin-install', - 'javelin-dom', - 'phuix-icon-view', - 'phabricator-prefab', - ), 'fc91ab6c' => array( 'javelin-behavior', 'javelin-dom', diff --git a/webroot/rsrc/js/phuix/PHUIXAutocomplete.js b/webroot/rsrc/js/phuix/PHUIXAutocomplete.js index beb3660718..3bc5cf0166 100644 --- a/webroot/rsrc/js/phuix/PHUIXAutocomplete.js +++ b/webroot/rsrc/js/phuix/PHUIXAutocomplete.js @@ -304,6 +304,14 @@ JX.install('PHUIXAutocomplete', { }, _onselect: function (e) { + if (!e.isNormalMouseEvent()) { + // Eat right clicks, control clicks, etc., on the results. These can + // not do anything meaningful and if we let them through they'll blur + // the field and dismiss the results. + e.kill(); + return; + } + var target = e.getNode('typeahead-result'); for (var ii = 0; ii < this._listNodes.length; ii++) {