IMHO, when dropdown of autocomplete is not shown, the behaviour of the field should ignore the preventEnter setting. In other words, if the field with autocomplete is part of a form and the dropdown is not shown, by pressing enter the browser should submit the form.
I would then recommend the following change in main.ts from line 225
case 13: // ENTER
var isDropDownVisible = this._dd.isShown();
if (this._dd.isItemFocused) {
this._dd.selectFocusItem();
} else if (!this._selectedItem) {
if (this._$el.val() !== '') {
this._$el.trigger('autocomplete.freevalue', this._$el.val());
}
}
this._dd.hide();
if (isDropDownVisible && this._settings.preventEnter) {
// console.log('preventDefault');
evt.preventDefault();
}
break;
Alternatively, you may change the setting preventEnter to support multiple values:
- always
- only when dropdown is visible
- never
IMHO, when dropdown of autocomplete is not shown, the behaviour of the field should ignore the preventEnter setting. In other words, if the field with autocomplete is part of a form and the dropdown is not shown, by pressing enter the browser should submit the form.
I would then recommend the following change in main.ts from line 225
Alternatively, you may change the setting preventEnter to support multiple values: