Skip to content

Commit 05fc920

Browse files
feat(select): getting multiple to type 1 char at a time
1 parent fe7322e commit 05fc920

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/kit-headless/src/components/select/use-select.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ export function useTypeahead() {
1717
return;
1818
}
1919

20-
inputStrSig.value += key;
21-
2220
const firstCharOnly$ = $(() => {
21+
console.log('herehrere');
22+
2323
// First opens the listbox if it is not already displayed and then moves visual focus to the first option that matches the typed character.
2424
const singleInputChar = key.toLowerCase();
2525

@@ -56,15 +56,17 @@ export function useTypeahead() {
5656

5757
const multipleChars$ = $(() => {
5858
console.log(inputStrSig.value);
59-
6059
// If multiple keys are typed in quick succession, visual focus moves to the first option that matches the full string.
6160
clearTimeout(prevTimeoutSig.value);
6261
prevTimeoutSig.value = setTimeout(() => {
6362
inputStrSig.value = '';
6463
}, 1000);
6564
});
65+
//
66+
if (inputStrSig.value.length === 1) {
67+
firstCharOnly$();
68+
}
6669

67-
firstCharOnly$();
6870
multipleChars$();
6971
});
7072

0 commit comments

Comments
 (0)