-
Notifications
You must be signed in to change notification settings - Fork 407
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
Prop to disable active index change on up / down keys #635
Comments
So, looks like I was able to make due simply by disabling the up / down behavior and handling those key events on my own. However, I had to modify the source, to disable the default up / down behavior. It also seems that no other area of code was affected... May I request just a simple disabling of this option, based on a 'enableDefaultUpDownSelection'={true | false} prop?
|
Hi @learningdesignlabs, thanks for opening this issue! It sounds like the behavior you'd like is for the |
Hi Ericgio, thanks so much for the response, I would say allowing activeIndex to default to the selected item would be a great feature, but in this use case there is some additional custom behavior beyond the current item being selected.. For example, in Google calendar if the value is 2:43pm, it will scroll the user down to 2:45pm, without highlighting it.. in which case, activeIndex isn't set, but the scroll position has changed. In short, from my point of view being allowed to completely control behavior on Up / Down (vs having the system modify activeIndex, and also running my custom code via the onKeyDown prop), by disabling that line of code I mentioned above, would really solve this use case without too much rework.. |
Perusing the existing issues, I can see that active index is meant to be internal.
However, I believe there's a use case for being able to set it as a prop: when the options are sequential (as in a list of available times to choose from), and if we want behavior similar to how Google calendar events work, where adjacent options should still be displayed, we'd want to have the current option highlighted and selectable from pressing Enter:
Sample select behavior for sequential choices
Additionally, if we want the option of pressing up/down and moving from our current time to a new one, at the moment, even a custom menu and menu item render won't allow this behavior, because the current UP / DOWN behavior is part of the source code and always starts from the very first item of the list.
As I understand, if I could pass a function that specifies the active index, then I could base the active index off of the current selected value. Or, perhaps there is a way to expose the "_handleActiveIndexChange" function?
The text was updated successfully, but these errors were encountered: