Skip to content

Commit 3cc210f

Browse files
Fix wrong timing for firing custom event for selection. event name changed from pt-item-changed to pt-item-confirmed.
1 parent cfcf9a3 commit 3cc210f

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

paper-typeahead-input.html

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ <h3>{{label}}</h3>
9090

9191
<template is="dom-if" if="{{_suggestions.length}}">
9292
<paper-material >
93-
<paper-menu on-iron-select="_itemSelect" on-iron-items-changed="_itemsChanged">
93+
<paper-menu on-iron-select="_itemSelect">
9494
<template is="dom-repeat" items="{{_suggestions}}">
95-
<paper-item on-mouseover="_selecton" on-tap="_select">
95+
<paper-item on-mouseover="_selecton" on-tap="_select">
9696
<span>{{item}}</span>
9797
</paper-item>
9898
</template>
@@ -118,7 +118,7 @@ <h3>{{label}}</h3>
118118
/**
119119
* Fired when an item in the suggestion list is confirmed, either by hit enter key where element selected or clicked on the element directly by mouse.
120120
*
121-
* @event pt-item-changed
121+
* @event pt-item-confirmed
122122
*/
123123
properties: {
124124

@@ -261,9 +261,6 @@ <h3>{{label}}</h3>
261261
//
262262
// Use this to clean up anything you did in `attached`.
263263
},
264-
_itemsChanged:function(e,detail){
265-
this.fire('pt-item-changed',detail);
266-
},
267264
_itemSelect:function(e, detail){
268265
this.fire('pt-item-select',detail);
269266
},
@@ -279,7 +276,7 @@ <h3>{{label}}</h3>
279276
}
280277
},
281278
/**
282-
* Callback on click event on paper-item
279+
* Callback on mouseover event on paper-item
283280
*
284281
*/
285282
_selecton:function(e){
@@ -306,6 +303,7 @@ <h3>{{label}}</h3>
306303
index = Number(suggestionsMenu.indexOf(selectedItem));
307304
this.inputValue = this._suggestions[index];
308305
this._suggestions = [];
306+
this.fire('pt-item-confirmed',e.target);
309307
e.stopPropagation();
310308
}
311309
else{
@@ -351,6 +349,7 @@ <h3>{{label}}</h3>
351349
index = Number(suggestionsMenu.indexOf(selectedItem));
352350
this.inputValue = this._suggestions[index];
353351
this._suggestions = [];
352+
this.fire('pt-item-confirmed',selectedItem);
354353
}
355354
}
356355
}

0 commit comments

Comments
 (0)