-
Notifications
You must be signed in to change notification settings - Fork 530
[added] Allow Tab to select option #186
base: master
Are you sure you want to change the base?
Conversation
| value: React.PropTypes.any, | ||
| onChange: React.PropTypes.func, | ||
| onSelect: React.PropTypes.func, | ||
| selectOnTab: React.PropTypes.bool.isRequired, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best practice is to mark props as isRequired if they have a default, as they'll never not be set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this backwards compatible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as it defaults to false on line 42.
| }, | ||
|
|
||
| Enter (event) { | ||
| if (this.state.isOpen === false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was moved to a new method handleKeyboardSelection below.
|
When will this be added to the package? |
|
Any updates on this? |
|
I'd love to have this added :) |
|
If you want to get this before it's merged, you can use my fork: I've been using this on a live site since November 2016 and haven't had any issues with it. @CMTegner Any chance of getting this in? I'm happy to rebase it. |
|
This, what I would call, vital piece of functionality needs to be merged. This PR is over 2 years old. Is this library in maintenance mode??? I hope not with 40k+ downloads a week. |
Adds the ability to press Tab to select the currently highlighted option. This is consistent with most other autocompletion components (see https://jedwatson.github.io/react-select/, http://react-autosuggest.js.org/, https://harvesthq.github.io/chosen/, https://jqueryui.com/autocomplete/, http://easyautocomplete.com/, etc). I've added a prop to enable this, and have enabled it by default. This is mainly so it can be disabled just in case there's any issues.
Also adds a new
selectionMethodargument toonSelectthat specifies the method used to select the option. This will be one ofclick(if the item was selected with the mouse),Enter, orTab. This allows the user to handle tab differently to enter.Closes #182