fix: update theme preview on focus change (#562)

Treat default select focus as initial state so /theme and first-run previews follow keyboard navigation again.

Co-authored-by: anandh8x <test@example.com>
This commit is contained in:
Anandan
2026-04-10 19:25:15 +05:30
committed by GitHub
parent 68c296833d
commit 692471850f
3 changed files with 161 additions and 107 deletions

View File

@@ -35,6 +35,11 @@ export type UseSelectStateProps<T> = {
*/
onFocus?: (value: T) => void
/**
* Initial value to focus when the component mounts.
*/
defaultFocusValue?: T
/**
* Value to focus
*/
@@ -131,6 +136,7 @@ export function useSelectState<T>({
onChange,
onCancel,
onFocus,
defaultFocusValue,
focusValue,
}: UseSelectStateProps<T>): SelectState<T> {
const [value, setValue] = useState<T | undefined>(defaultValue)
@@ -138,7 +144,7 @@ export function useSelectState<T>({
const navigation = useSelectNavigation<T>({
visibleOptionCount,
options,
initialFocusValue: undefined,
initialFocusValue: defaultFocusValue,
onFocus,
focusValue,
})