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

Prevent scrollIntoView when component is mounted #317

Open
genius257 opened this issue Oct 21, 2024 · 1 comment
Open

Prevent scrollIntoView when component is mounted #317

genius257 opened this issue Oct 21, 2024 · 1 comment

Comments

@genius257
Copy link

Currently when component is mounted it triggers the first item to be selected by default, followed by that item being scrolled into view.
I would like an option to disable the scroll, when no user interaction has occurred, yet.

This issue could be solved via #171, but a ideal solution would be a way to just disable the scroll on mount, and not being forced to have nothing as the selection.

@andrewdoro
Copy link

cmdk/cmdk/src/index.tsx

Lines 230 to 232 in 9827edf

useLayoutEffect(() => {
schedule(6, scrollSelectedIntoView)
}, [])

this is the code triggering the scroll

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

2 participants