Skip to content

Commit 629bf66

Browse files
author
Cameron Austgen
authored
increase useTypeSelect() debounce buffer rate to 1000ms (#3573)
Increasing the typeahead buffer to 1 second.
1 parent 4ffc040 commit 629bf66

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/@react-aria/selection/src/useTypeSelect.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ import {DOMAttributes, KeyboardDelegate} from '@react-types/shared';
1414
import {Key, KeyboardEvent, useRef} from 'react';
1515
import {MultipleSelectionManager} from '@react-stately/selection';
1616

17+
/**
18+
* Controls how long to wait before clearing the typeahead buffer.
19+
*/
20+
const TYPEAHEAD_DEBOUNCE_WAIT_MS = 1000; // 1 second
21+
1722
export interface AriaTypeSelectOptions {
1823
/**
1924
* A delegate that returns collection item keys with respect to visual layout.
@@ -84,7 +89,7 @@ export function useTypeSelect(options: AriaTypeSelectOptions): TypeSelectAria {
8489
clearTimeout(state.timeout);
8590
state.timeout = setTimeout(() => {
8691
state.search = '';
87-
}, 500);
92+
}, TYPEAHEAD_DEBOUNCE_WAIT_MS);
8893
};
8994

9095
return {

0 commit comments

Comments
 (0)