Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DropdownMenuTrigger gets focused after closing the menu #3106

Open
bockster6669 opened this issue Sep 5, 2024 · 0 comments
Open

DropdownMenuTrigger gets focused after closing the menu #3106

bockster6669 opened this issue Sep 5, 2024 · 0 comments

Comments

@bockster6669
Copy link

Hello, folks! From the past two days I was fighting with my textarea element to find why it wont focus when I call the .focus() method on it and just now I saw why.

After long searching the net, I found a useful article which tells how to know which part of the page gets focused and then I saw that when I close the dropdown menu it triggers focus on its dropDownMenuTrigger element, which under the hood is a Button element.

And thats how I found why my textarea gets focused for 0.3 seconds and then it blurs. So how I can prevent this behaviour. For now the only solution I found is to usesetTimeout(()=>textarea.focus(), 300) .

I am not exactly sure why I have to wait, I think its maybe because there is an animation of closing the menu, which I should wait. If there is a better solution, please reach to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant