Skip to content
Open
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
19 changes: 1 addition & 18 deletions content/patterns/combobox/examples/js/select-only.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ const Select = function (el, options = []) {
this.activeIndex = 0;
this.open = false;
this.searchString = '';
this.searchTimeout = null;

// init
if (el && this.comboEl && this.listboxEl) {
Expand Down Expand Up @@ -226,22 +225,6 @@ Select.prototype.createOption = function (optionText, index) {
return optionEl;
};

Select.prototype.getSearchString = function (char) {
// reset typing timeout and start new timeout
// this allows us to make multiple-letter matches, like a native select
if (typeof this.searchTimeout === 'number') {
window.clearTimeout(this.searchTimeout);
}

this.searchTimeout = window.setTimeout(() => {
this.searchString = '';
}, 500);

// add most recent letter to saved search string
this.searchString += char;
return this.searchString;
};

Select.prototype.onLabelClick = function () {
this.comboEl.focus();
};
Expand Down Expand Up @@ -302,7 +285,7 @@ Select.prototype.onComboType = function (letter) {
this.updateMenuState(true);

// find the index of the first matching option
const searchString = this.getSearchString(letter);
const searchString = letter;
const searchIndex = getIndexByLetter(
this.options,
searchString,
Expand Down
Loading