This commit is contained in:
Philipp Dormann 2025-05-20 01:28:33 +02:00
parent 9ef34359d8
commit a00af08b3f
Signed by: philipp
GPG Key ID: 3BB9ADD52DCA4314
2 changed files with 8 additions and 4 deletions

View File

@ -110,8 +110,12 @@
console.log("Cleared selection"); console.log("Cleared selection");
}} }}
options={runners} options={runners}
filterFn={(option, searchTerm) => { filterFn={(item, searchTerm) => {
return option.label.toLowerCase().includes(searchTerm.toLowerCase()); if (searchTerm.startsWith("#")) {
const id = parseInt(searchTerm.replace("#", ""));
return item.value.id === id;
}
return item.label.toLowerCase().includes(searchTerm.toLowerCase());
}} }}
bind:selected={runnerinfo} bind:selected={runnerinfo}
inputAriaLabel={$_("search-for-runner-by-name-or-id")} inputAriaLabel={$_("search-for-runner-by-name-or-id")}

View File

@ -77,7 +77,7 @@
function selectOption(option) { function selectOption(option) {
selected = option.value; selected = option.value;
isOpen = false; isOpen = false;
searchTerm = option.label; searchTerm = option.label; // Set searchTerm to the selected option's label
focusedIndex = -1; focusedIndex = -1;
dispatch("onSelected", option.value); dispatch("onSelected", option.value);
} }