Skip to content

Commit

Permalink
Merge pull request #1 from lashab/feature/preselect
Browse files Browse the repository at this point in the history
Add preselect functionality
  • Loading branch information
lashab authored Oct 20, 2016
2 parents ac429fb + 3658dac commit 00e6df4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions dist/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ var MissPlete =
if (_this.ul) {
// dropdown visible?
switch (event.keyCode) {
case 9:
case 13:
event.preventDefault();
_this.selectFn(_this.scoredOptions[_this.highlightedIndex]);
break;
case 27:
Expand Down Expand Up @@ -200,6 +202,8 @@ var MissPlete =
this.input.parentNode.insertBefore(newContainer, this.input.nextSibling);
this.container = newContainer;
this.ul = newUl;

this.changeHighlightedOption(0);
}
}
}, {
Expand Down
4 changes: 4 additions & 0 deletions src/MissPlete.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class MissPlete {
this.input.addEventListener('keydown', event => {
if (this.ul) { // dropdown visible?
switch (event.keyCode) {
case 9:
case 13:
event.preventDefault();
this.selectFn(this.scoredOptions[this.highlightedIndex]);
break;
case 27: // Esc
Expand Down Expand Up @@ -155,6 +157,8 @@ class MissPlete {
this.input.parentNode.insertBefore(newContainer, this.input.nextSibling);
this.container = newContainer;
this.ul = newUl;

this.changeHighlightedOption(0);
}
}

Expand Down
7 changes: 4 additions & 3 deletions website/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion website/bundle.js.map

Large diffs are not rendered by default.

0 comments on commit 00e6df4

Please sign in to comment.