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

Feature Request: Add onNavigate Prop to Enhance Keyboard Navigation in Select Component #10

Open
vmarcosp opened this issue Apr 15, 2024 · 0 comments

Comments

@vmarcosp
Copy link

Description

I propose adding an onNavigate prop to the Select component in the Ink UI library. This enhancement will enable developers to implement custom behavior when navigating through options using the keyboard arrow keys. Currently, the Select component supports selection changes through the onChange prop, which triggers when an option is selected via the Enter key. The new onNavigate prop would complement this by handling state changes or side effects during the navigation process before an option is selected.

Expected Behavior

The onNavigate prop should be a function that gets executed every time a user navigates to a new option using the arrow keys. It could be useful for scenarios such as previewing option details or updating the application state based on the currently focused option.

Use Case Example

<Select
  options={[{ label: 'Option 1', value: '1' }, { label: 'Option 2', value: '2' }]}
  onChange={handleSelect}
  onNavigate={handleNavigate}
/>

💡 I am willing and prepared to open a pull request to implement this feature.

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

1 participant