ui
ui copied to clipboard
[bug]: Select not focus input
Describe the bug
When selecting an element of a select that is associated with the focus input action, the input does not get focus but focuses on that select
Affected component/components
Select, Input
How to reproduce
1: Create select 2: Create Input 3: Attach events related to focus input when change value select
Codesandbox/StackBlitz link
No response
Logs
No response
System Info
Browers
Before submitting
- [X] I've made research efforts and searched the documentation
- [X] I've searched for existing issues
same here
Could you share the code you are using to focus the input when the select value changes? Introducing a short delay resolved this issue for me.
const handleSelectChange = (value: string) => {
...
setTimeout(() => {
inputRef.current?.focus();
}, 100); // Small delay to ensure the DOM is updated
...
};
Hi. We're closing some old issues as outdated. If this is still relevant, leave a message, we'll reopen it. Thank you. Appreciate your contribution to the project - shadcn