From 6bc5ed39a24ddf847f7b90d8e6fb59cb13ae5b55 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 19 Sep 2013 15:42:02 -0700 Subject: [PATCH] Fix two tokenizer issues on iDevices Summary: Fixes T3853. See inline comments for details. Test Plan: Using iOS simulator, mashed the right hand side of tokenizers. Reviewers: chad, btrahan Reviewed By: chad CC: aran Maniphest Tasks: T3853 Differential Revision: https://secure.phabricator.com/D7049 --- src/__celerity_resource_map__.php | 46 +++++++++---------- .../lib/control/tokenizer/Tokenizer.js | 20 +++++++- 2 files changed, 41 insertions(+), 25 deletions(-) diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 46431174ab..598f1a5b21 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -2667,7 +2667,7 @@ celerity_register_resource_map(array( ), 'javelin-tokenizer' => array( - 'uri' => '/res/1867b9e3/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js', + 'uri' => '/res/cddb70f3/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js', 'type' => 'js', 'requires' => array( @@ -4351,7 +4351,7 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/96909266/diffusion.pkg.js', 'type' => 'js', ), - 'a68dc06a' => + '9564fa17' => array( 'name' => 'javelin.pkg.js', 'symbols' => @@ -4377,7 +4377,7 @@ celerity_register_resource_map(array( 18 => 'javelin-tokenizer', 19 => 'javelin-history', ), - 'uri' => '/res/pkg/a68dc06a/javelin.pkg.js', + 'uri' => '/res/pkg/9564fa17/javelin.pkg.js', 'type' => 'js', ), '36d5d071' => @@ -4434,7 +4434,7 @@ celerity_register_resource_map(array( 'global-drag-and-drop-css' => 'b1d5e69b', 'inline-comment-summary-css' => '44bfe40c', 'javelin-aphlict' => '8977e356', - 'javelin-behavior' => 'a68dc06a', + 'javelin-behavior' => '9564fa17', 'javelin-behavior-aphlict-dropdown' => '8977e356', 'javelin-behavior-aphlict-listen' => '8977e356', 'javelin-behavior-aphront-basic-tokenizer' => '8977e356', @@ -4485,25 +4485,25 @@ celerity_register_resource_map(array( 'javelin-behavior-repository-crossreference' => '5e9e5c4e', 'javelin-behavior-toggle-class' => '8977e356', 'javelin-behavior-workflow' => '8977e356', - 'javelin-dom' => 'a68dc06a', - 'javelin-event' => 'a68dc06a', - 'javelin-history' => 'a68dc06a', - 'javelin-install' => 'a68dc06a', - 'javelin-json' => 'a68dc06a', - 'javelin-mask' => 'a68dc06a', - 'javelin-request' => 'a68dc06a', - 'javelin-resource' => 'a68dc06a', - 'javelin-stratcom' => 'a68dc06a', - 'javelin-tokenizer' => 'a68dc06a', - 'javelin-typeahead' => 'a68dc06a', - 'javelin-typeahead-normalizer' => 'a68dc06a', - 'javelin-typeahead-ondemand-source' => 'a68dc06a', - 'javelin-typeahead-preloaded-source' => 'a68dc06a', - 'javelin-typeahead-source' => 'a68dc06a', - 'javelin-uri' => 'a68dc06a', - 'javelin-util' => 'a68dc06a', - 'javelin-vector' => 'a68dc06a', - 'javelin-workflow' => 'a68dc06a', + 'javelin-dom' => '9564fa17', + 'javelin-event' => '9564fa17', + 'javelin-history' => '9564fa17', + 'javelin-install' => '9564fa17', + 'javelin-json' => '9564fa17', + 'javelin-mask' => '9564fa17', + 'javelin-request' => '9564fa17', + 'javelin-resource' => '9564fa17', + 'javelin-stratcom' => '9564fa17', + 'javelin-tokenizer' => '9564fa17', + 'javelin-typeahead' => '9564fa17', + 'javelin-typeahead-normalizer' => '9564fa17', + 'javelin-typeahead-ondemand-source' => '9564fa17', + 'javelin-typeahead-preloaded-source' => '9564fa17', + 'javelin-typeahead-source' => '9564fa17', + 'javelin-uri' => '9564fa17', + 'javelin-util' => '9564fa17', + 'javelin-vector' => '9564fa17', + 'javelin-workflow' => '9564fa17', 'lightbox-attachment-css' => 'b1d5e69b', 'maniphest-task-summary-css' => '36d5d071', 'maniphest-transaction-detail-css' => '36d5d071', diff --git a/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js b/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js index c2343b45d9..3c5736c134 100644 --- a/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js +++ b/webroot/rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js @@ -93,6 +93,15 @@ JX.install('Tokenizer', { null, JX.bind(this, this.handleEvent)); + // NOTE: Safari on the iPhone does not normally delegate click events on + //
tags. This causes the event to fire. We want a click (in this + // case, a touch) anywhere in the div to trigger this event so that we + // can focus the input. Without this, you must tap an arbitrary area on + // the left side of the input to focus it. + // + // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html + input_container.onclick = JX.bag; + JX.DOM.listen( input_container, 'click', @@ -193,7 +202,6 @@ JX.install('Tokenizer', { }, handleEvent : function(e) { - this._typeahead.handleEvent(e); if (e.getPrevented()) { return; @@ -392,7 +400,15 @@ JX.install('Tokenizer', { focus : function() { var focus = this._focus; JX.DOM.show(focus); - setTimeout(function() { JX.DOM.focus(focus); }, 0); + + // NOTE: We must fire this focus event immediately (during event + // handling) for the iPhone to bring up the keyboard. Previously this + // focus was wrapped in setTimeout(), but it's unclear why that was + // necessary. If this is adjusted later, make sure tapping the inactive + // area of the tokenizer to focus it on the iPhone still brings up the + // keyboard. + + JX.DOM.focus(focus); }, _didfocus : function() {