1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 11:30:55 +01:00

Better fix for autocomplete blur (select on mousedown instead of delaying blur)

Summary: Ref T10163. I would still sometimes not get a replacement after clicking with the delayed blur. This seems to fix the issue more consistently: instead of listening for a click event (which fires after the blur), listen for a mousedown event (which fires before the blur).

Test Plan: Observed consistent selection via mouse locally.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10163

Differential Revision: https://secure.phabricator.com/D15032
This commit is contained in:
epriestley 2016-01-15 09:38:39 -08:00
parent 3c19004f9f
commit 7f19216e44
2 changed files with 11 additions and 17 deletions

View file

@ -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' => '2b735afc',
'rsrc/js/phuix/PHUIXAutocomplete.js' => '3d6e37cc',
'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' => '2b735afc',
'phuix-autocomplete' => '3d6e37cc',
'phuix-dropdown-menu' => 'bd4c8dca',
'phuix-form-control-view' => '8fba1997',
'phuix-icon-view' => 'bff6884b',
@ -1023,12 +1023,6 @@ return array(
'javelin-install',
'javelin-util',
),
'2b735afc' => array(
'javelin-install',
'javelin-dom',
'phuix-icon-view',
'phabricator-prefab',
),
'2b8de964' => array(
'javelin-install',
'javelin-util',
@ -1086,6 +1080,12 @@ return array(
'javelin-util',
'javelin-uri',
),
'3d6e37cc' => array(
'javelin-install',
'javelin-dom',
'phuix-icon-view',
'phabricator-prefab',
),
'3ee3408b' => array(
'javelin-behavior',
'javelin-behavior-device',

View file

@ -55,19 +55,13 @@ JX.install('PHUIXAutocomplete', {
JX.bind(this, this._update));
var select = JX.bind(this, this._onselect);
JX.DOM.listen(this._getNode(), 'click', 'typeahead-result', select);
JX.DOM.listen(this._getNode(), 'mousedown', 'typeahead-result', select);
var device = JX.bind(this, this._ondevice);
JX.Stratcom.listen('phabricator-device-change', null, device);
// When the user clicks away from the textarea, deactivate. However, we
// don't want to deactivate if we're blurring because they clicked an
// option in the dropdown, so put a timeout on the deactivation. This
// will let the click run first if they did actually click a result.
var deactivate = JX.bind(this, function() {
setTimeout(JX.bind(this, this._deactivate), 10);
});
// When the user clicks away from the textarea, deactivate.
var deactivate = JX.bind(this, this._deactivate);
JX.DOM.listen(area, 'blur', null, deactivate);
},