When Draggable unmounts, if a textbox is focused, the textbox loses focus inexplicably
See original GitHub issueMy app renders some Items depending on the content of several text input.
The Items each contain a Draggable.
I’m coming across this very strange behavior:
- I type a valid value into a textbox, causing some Items to render
- Without leaving the textbox, I delete or add a few characters to make the value invalid
- The Items disappear (unmount)
- My textbox suddenly loses focus. However, no
onBlurhandlers are called, and if I switch tabs / windows and then switch back, focus is restored - I can prevent this issue by deleting the Draggable component
Here’s a codesandbox showing the issue: https://codesandbox.io/s/32x3voojm5
I can consistently reproduce this.
Browser is Chrome 64.0.3282.119 (Official Build) (64-bit) on Mac OSX.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:13
- Comments:10 (1 by maintainers)
Top Results From Across the Web
When Draggable unmounts, if a textbox is focused ... - GitHub
My textbox suddenly loses focus. However, no onBlur handlers are called, and if I switch tabs / windows and then switch back, focus...
Read more >jQuery-focused textbox loses focus after one character of input ...
After the first character of input is typed, the input box loses focus and further typing doesn't work unless it's manually clicked for...
Read more >TextBox.LostFocus event (Access) - Microsoft Learn
In this article The LostFocus event occurs when the specified object loses the focus.
Read more >TextBox loses focus after typing a letter in UI for Blazor - Telerik
The TelerikTextBox losing focus after each keystroke appears to be a side-effect of the implementation. This is probably happening because the ...
Read more >https://public.ukp.informatik.tu-darmstadt.de/emnl...
If I am in the terminal and then decide I want to open a web page, I switch to Space 2, where the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Looks like it is an issue in the
enableUserSelectHackpropenableUserSelectHack causes this to be called
You could try
But I didn’t look into what consequence not calling
removeUserSelectStyleswould have.Working: https://codesandbox.io/s/944j9x101o
Thank you guys! I have encounter the same problem, my filter lose focus cause the Draggable. And enableUserSelectHack={false} fixed my problem.