<Enter> when an element of the form is focused should submit the form.
Before this patch, when <Enter> was pressed on the submitter button,
nothing would happen.
So, we tweak our <Enter> handling on the submitter input a bit more:
<Enter> can be used to select the submitter from the autocompletion
list, but, when pressed a second time (ie. when the autocompletion
option has be selected and the dropdown isn't shown), we submit the
form.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
var original = self.onKeyDown;
return function (e) {
+ var wasOpened = this.isOpen;
original.apply(this, arguments);
- if (e.keyCode === 13 && this.$control_input.val() != '' )
+ if (e.keyCode === 13 &&
+ (this.$control_input.val() != '' || !wasOpened))
self.trigger('submit');
};
})();