-
-
Notifications
You must be signed in to change notification settings - Fork 284
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
First item is selected by default - can this be disabled? #171
Comments
Actually, this was easy once I figured out how. You can set the value prop on the Command component to the item you want to be selected first. |
My solution is to add a hidden value to it will be automatically selected: <CommandItem value="-" className="hidden" /> The hidden class make sure it will not be visible but still controlled and selected by |
+1 on this being a somewhat arbitrary requirement. We should have the flexibility to set this |
@pacocoursey Do I understand correctly that in v1.0 it's still not possible to disable the auto-select of the first item? Is it some sort of accessibility concern? |
Heres an example where only the CommandItem selected is highlighted on render
|
If the component sits below the fold, the page will always scroll to the first selected item, which is a pain. Any way to disable any kind of selection on render would be much appreciated. |
This solution preserves selected value and allows keyboard navigation.
|
would be cool to get an API for this. |
Just wondering whether the default behaviour of selecting the first item in the list is some sort of accessibility requirement (if so, could you please point to the docs?), and whether this is something the can be disabled?
I was looking for something like
selectFirstItem={false}
but couldn't find such API.The text was updated successfully, but these errors were encountered: