Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preselect functionality #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.