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
Tab to select #164
Tab to select #164
Conversation
Conflicts: src/AutosuggestContainer.js
4c9cea5
to
67ac04f
Compare
|
||
case 'Tab': { | ||
if (tabToSelect) { | ||
event.preventDefault(); |
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 may need to be moved inside the if below. Users may want to tab to another field when there's no focused suggestion.
@rickhanlonii Thanks a lot for a detailed PR! I must admit that I'm a bit confused with the functionality you are trying to achieve. In #163 you mentioned "Slack user mentions". As far as I can see, pressing Tab in Slack is somewhat equivalent to pressing Down, not pressing Enter, i.e. it moves to the next suggestion rather than selecting the focused one. The URL bar in Chrome behaves the same. Am I missing something? |
Great point @moroshko, I'll update and re-open. |
@@ -54,6 +54,18 @@ export const onSuggestionsUpdateRequested = sinon.spy(({ value }) => { | |||
}); | |||
}); | |||
|
|||
export const tabToSelect = { |
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.
Note: also going to update this API per the comments here.
Overview
Adds a setting
tabToSelect
to allow tabbing to select suggestion.Closes #163
Details
tabToSelect
(defaults to false)Tab
event type toonSuggestionsUpdateRequested
andonSuggestionSelected