Merge "Fix autocomplete popup focus error"
diff --git a/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete.js b/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete.js
index 31918dd..601a056 100644
--- a/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete.js
+++ b/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete.js
@@ -118,11 +118,11 @@
},
attached: function() {
- this.listen(document.body, 'click', '_handleBodyClick');
+ this.listen(document.body, 'tap', '_handleBodyTap');
},
detached: function() {
- this.unlisten(document.body, 'click', '_handleBodyClick');
+ this.unlisten(document.body, 'tap', '_handleBodyTap');
},
get focusStart() {
@@ -233,7 +233,7 @@
}
},
- _handleBodyClick: function(e) {
+ _handleBodyTap: function(e) {
var eventPath = Polymer.dom(e).path;
for (var i = 0; i < eventPath.length; i++) {
if (eventPath[i] === this) {
@@ -244,6 +244,7 @@
},
_handleSuggestionTap: function(e) {
+ e.stopPropagation();
this.$.cursor.setCursor(e.target);
this._commit();
this.focus();
diff --git a/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.html b/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.html
index 7a26e72..685f568 100644
--- a/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.html
+++ b/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.html
@@ -290,6 +290,7 @@
assert.isTrue(focusSpy.called);
assert.isTrue(commitSpy.called);
assert.isTrue(element.$.suggestions.hasAttribute('hidden'));
+ assert.isTrue(element._focused);
focusSpy.restore();
commitSpy.restore();
});