From 8410a8019a91bf138105e7b4d7b6ca59df07e1a4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 10 May 2013 10:23:32 -0700 Subject: [PATCH] Fix tab-focus of Tokenizers Summary: Fixes T3140. Previously, we added the highlight class only on explicit events, but not on actual focus events (e.g., via tab). Test Plan: Tabbed into a tokenizer. Clicked a tokenizer. Tabbed out of a tokenizer. Clicked out of a tokenizer. Shift-tabbed out of a tokenizer. Verified highlight state was always correct. Reviewers: chad Reviewed By: chad CC: aran Maniphest Tasks: T3140 Differential Revision: https://secure.phabricator.com/D5891 --- src/__celerity_resource_map__.php | 44 +++++++++---------- .../lib/control/tokenizer/Tokenizer.js | 9 ++-- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 15a590e516..a635cc9655 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -2561,7 +2561,7 @@ celerity_register_resource_map(array( ), 'javelin-tokenizer' => array( - 'uri' => '/res/8bccdb9e/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js', + 'uri' => '/res/2c55cb68/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js', 'type' => 'js', 'requires' => array( @@ -4185,7 +4185,7 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/f96657b8/diffusion.pkg.js', 'type' => 'js', ), - '7d174323' => + '202a3dd0' => array( 'name' => 'javelin.pkg.js', 'symbols' => @@ -4210,7 +4210,7 @@ celerity_register_resource_map(array( 17 => 'javelin-typeahead-ondemand-source', 18 => 'javelin-tokenizer', ), - 'uri' => '/res/pkg/7d174323/javelin.pkg.js', + 'uri' => '/res/pkg/202a3dd0/javelin.pkg.js', 'type' => 'js', ), '6b1fccc6' => @@ -4270,7 +4270,7 @@ celerity_register_resource_map(array( 'global-drag-and-drop-css' => '56e0b740', 'inline-comment-summary-css' => 'dd27a69b', 'javelin-aphlict' => '26980a1c', - 'javelin-behavior' => '7d174323', + 'javelin-behavior' => '202a3dd0', 'javelin-behavior-aphlict-dropdown' => '26980a1c', 'javelin-behavior-aphlict-listen' => '26980a1c', 'javelin-behavior-aphront-basic-tokenizer' => '26980a1c', @@ -4321,24 +4321,24 @@ celerity_register_resource_map(array( 'javelin-behavior-repository-crossreference' => '27c55b30', 'javelin-behavior-toggle-class' => '26980a1c', 'javelin-behavior-workflow' => '26980a1c', - 'javelin-dom' => '7d174323', - 'javelin-event' => '7d174323', - 'javelin-install' => '7d174323', - 'javelin-json' => '7d174323', - 'javelin-mask' => '7d174323', - 'javelin-request' => '7d174323', - 'javelin-resource' => '7d174323', - 'javelin-stratcom' => '7d174323', - 'javelin-tokenizer' => '7d174323', - 'javelin-typeahead' => '7d174323', - 'javelin-typeahead-normalizer' => '7d174323', - 'javelin-typeahead-ondemand-source' => '7d174323', - 'javelin-typeahead-preloaded-source' => '7d174323', - 'javelin-typeahead-source' => '7d174323', - 'javelin-uri' => '7d174323', - 'javelin-util' => '7d174323', - 'javelin-vector' => '7d174323', - 'javelin-workflow' => '7d174323', + 'javelin-dom' => '202a3dd0', + 'javelin-event' => '202a3dd0', + 'javelin-install' => '202a3dd0', + 'javelin-json' => '202a3dd0', + 'javelin-mask' => '202a3dd0', + 'javelin-request' => '202a3dd0', + 'javelin-resource' => '202a3dd0', + 'javelin-stratcom' => '202a3dd0', + 'javelin-tokenizer' => '202a3dd0', + 'javelin-typeahead' => '202a3dd0', + 'javelin-typeahead-normalizer' => '202a3dd0', + 'javelin-typeahead-ondemand-source' => '202a3dd0', + 'javelin-typeahead-preloaded-source' => '202a3dd0', + 'javelin-typeahead-source' => '202a3dd0', + 'javelin-uri' => '202a3dd0', + 'javelin-util' => '202a3dd0', + 'javelin-vector' => '202a3dd0', + 'javelin-workflow' => '202a3dd0', 'lightbox-attachment-css' => '56e0b740', 'maniphest-task-summary-css' => '6b1fccc6', 'maniphest-transaction-detail-css' => '6b1fccc6', diff --git a/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js b/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js index 98f8c1ee23..04b90e26a8 100644 --- a/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js +++ b/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js @@ -213,6 +213,8 @@ JX.install('Tokenizer', { // Explicitly update the placeholder since we just wiped the field // value. this._typeahead.updatePlaceholder(); + } else if (e.getType() == 'focus') { + this._didfocus(); } }, @@ -380,16 +382,17 @@ JX.install('Tokenizer', { focus : function() { var focus = this._focus; JX.DOM.show(focus); + setTimeout(function() { JX.DOM.focus(focus); }, 0); + }, + _didfocus : function() { JX.DOM.alterClass( this._containerNode, 'jx-tokenizer-container-focused', true); - - setTimeout(function() { JX.DOM.focus(focus); }, 0); }, - _didblur: function() { + _didblur : function() { JX.DOM.alterClass( this._containerNode, 'jx-tokenizer-container-focused',