Fix focus issue with autocomplete

Due to asynchronous event handling, sometimes the _focused flag is not
properly set to 'true' even when the input is focused. With this change,
the _focused flag is set to true on keydown in the input.

Also sets a parameter on the cursor-manager for better UX.

Bug: Issue 4950
Change-Id: Ib53942f0d1ff86351bdbd33770696e1bb3e029ca
This commit is contained in:
Kasper Nilsson
2016-11-23 14:25:39 -08:00
parent 034f79b9f4
commit 75154e3237
3 changed files with 3 additions and 1 deletions

View File

@@ -91,6 +91,7 @@
_handleRemove: function(e) {
var toRemove = e.detail.account;
this._removeAccount(toRemove);
this.$.entry.focus();
},
_removeAccount: function(toRemove) {
@@ -105,7 +106,6 @@
}
if (matches) {
this.splice('accounts', i, 1);
this.$.entry.focus();
return;
}
}

View File

@@ -73,6 +73,7 @@ limitations under the License.
id="cursor"
index="{{_index}}"
cursor-target-class="selected"
scroll-behavior="keep-visible"
stops="[[_getSuggestionElems(_suggestions)]]"></gr-cursor-manager>
</template>
<script src="gr-autocomplete.js"></script>

View File

@@ -199,6 +199,7 @@
},
_handleInputKeydown: function(e) {
this._focused = true;
switch (e.keyCode) {
case 38: // Up
e.preventDefault();