* @param {object} event event object
*/
_blur: function(event) {
- if (_data.get(event.currentTarget.id).options.restricted) {
+ var data = _data.get(event.currentTarget.id);
+ if (data.options.restricted) {
// restricted item lists only allow results from the dropdown to be picked
return;
}
window.setTimeout(function() {
var value = currentTarget.value.trim();
if (value.length) {
- this._addItem(currentTarget.id, { objectId: 0, value: value });
+ if (!data.suggestion || !data.suggestion.isActive()) {
+ this._addItem(currentTarget.id, { objectId: 0, value: value });
+ }
}
}.bind(this), 100);
}
}
},
+ /**
+ * Returns true if the suggestions are active.
+ * @return {boolean}
+ */
+ isActive: function() {
+ return (this._dropdownMenu !== null && UiSimpleDropdown.isOpen(this._element.id));
+ },
+
/**
* Handles the keyboard navigation for interaction with the suggestion list.
*
* @param {object} event event object
*/
_keyDown: function(event) {
- if (this._dropdownMenu === null || !UiSimpleDropdown.isOpen(this._element.id)) {
+ if (!this.isActive()) {
return true;
}