-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
autofocus input in floating element will make window scroll to top #2752
Comments
This is due to the browser focusing the input before the floating element was positioned (where it's at the top-left of the window initially). Use |
Can you give a code example, I have tried to use FocusManager, but not valid,I don't know to pass what props,thanks |
import { FloatingFocusManager } from '@floating-ui/react'; Only takes these two props to work: {open && (
<FloatingFocusManager context={context} modal={false}>
<div
ref={refs.setFloating}
style={{ ...floatingStyles }}
{...getFloatingProps()}
>
<input placeholder="search" />
</div>
</FloatingFocusManager>
)} |
Thanks for this! I was very confused why @atomiks You might consider mentioning on the FloatingFocusManager docs page not to use the |
Description
if a autofocus input or textarea in floating element , when floating element open, the window will auto scroll to top.
Code
GIF
The text was updated successfully, but these errors were encountered: