-
Notifications
You must be signed in to change notification settings - Fork 47.8k
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
[Flare] focus state not updated when moving to another Focus target with node.focus() #15942
Comments
cc @necolas |
Does the same thing happen with |
@necolas yeah, it happens with both |
This looks like a problem with synchronously moving DOM focus within the callbacks. You can see the same behaviour when using the existing event system: https://codesandbox.io/s/experimental-event-api-hlm4o (and how it is fixed by the setTimeout). Something like this came up in React Native for Web text inputs too. If you select the input and link elements in devtools and use |
I don't know if there are other scenarios in which an element could find itself blurred before it is focused, so using that to infer anything in the responder might end up breaking something else. |
I looked into this a bit more. It might be that using |
Closing as we're no longer developing this API. See #15257 (comment) |
@trueadm working with
Focus
alongside@reach/combobox
I encountered what looks like a bug related to programmatically callingnode.focus()
in an effect after a state update fromonFocusVisibleChange
(edit: andonFocusChange
), where the otherFocus
target that was blurred due to thefocus()
call doesn't call register that it's been blurred.That's a mouth-full, so here's a sample that repro's it for me:
How to Reproduce
Running this example with a build from
master
(deployed here http://react-events-focus-effect-bug.surge.sh/)input
by tabbing to it if it's not already focusedWhat Happens?
The link will register as focused (coloring it red) but that state gets stuck once the input is focused again.
What Should Happen?
Once the input gets focused again the
Focus
target inLink
should callonFocusVisibleChange
withfalse
so the focus state gets reset.The text was updated successfully, but these errors were encountered: