onDragEnd to set input focus issue #1475
Unanswered
ronnieli930
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I recently running into a issue, keen to learn the root cause of it from the community.
Here is a simple reproduce of my issue. Im using Nextjs, react, @dnd-kit/core, typescript.
Normally if I do
testRef?.current?.focus()
, the input field will have the cursor and if I directly type on keyboard, the value would change.But in this case I cannot type, but the outline of the input field and the log indicate that the focus is triggered. ONLY THAT I CANNOT Type.
I think it is the useDndMonitor makes it weird behind the scene because if it is a button on click listener, it would set the focus just fine.
But the very first of all, I want to know that why the text field is focused but not really (cannot type). Is the focus lost else where after the drag end?
Expect from answers:
How to make it work (after drop, it set the focus correctly, so that user can type directly). Updated: Here is the temporary workaround. On line 19 there seems to be a specific value for the
setTimeOut
, which is 50, value less than 50 still doesn't work.The root cause of this issue. (Why 50ms specifically?). It would be very nice of you if could explain through source code.
Links:
Beta Was this translation helpful? Give feedback.
All reactions