Skip to content

Commit 206208b

Browse files
committed
fix: restore focus to input on Escape when listbox is focused
The listbox has tabIndex={-1} so it can receive focus (e.g. clicking on padding or scrollbar). When Escape is pressed while the listbox holds focus, close() hides it and the browser dumps focus to body. Add input.current?.focus() after close(), matching the existing pattern in choose().
1 parent dc03180 commit 206208b

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎website/src/pages/playground/PlaygroundVersionCombobox.tsrx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ export function PlaygroundVersionCombobox(props: PlaygroundVersionComboboxProps)
207207
} else if (event.key === 'Escape' && (open || draft !== null)) {
208208
event.preventDefault();
209209
close();
210+
input.current?.focus();
210211
}
211212
};
212213

0 commit comments

Comments
 (0)