Skip to content

Tab to select - #164

Closed
rickhanlonii wants to merge 8 commits into
moroshko:masterfrom
rickhanlonii:tab-as-select
Closed

Tab to select#164
rickhanlonii wants to merge 8 commits into
moroshko:masterfrom
rickhanlonii:tab-as-select

Conversation

@rickhanlonii

@rickhanlonii rickhanlonii commented May 5, 2016

Copy link
Copy Markdown
Contributor

Overview

Adds a setting tabToSelect to allow tabbing to select suggestion.

Closes #163

Details

  • Adds property tabToSelect (defaults to false)
  • Sends Tab event type to onSuggestionsUpdateRequested and onSuggestionSelected
  • Updates README documentation with setting and event types for above functions
  • Adds tests for both true and false values of the setting

Comment thread src/Autosuggest.js

case 'Tab': {
if (tabToSelect) {
event.preventDefault();

Copy link
Copy Markdown
Contributor Author

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.

@moroshko

moroshko commented May 7, 2016

Copy link
Copy Markdown
Owner

@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?

@rickhanlonii

Copy link
Copy Markdown
Contributor Author

Great point @moroshko, I'll update and re-open.

});
});

export const tabToSelect = {

Copy link
Copy Markdown
Contributor Author

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.

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

Successfully merging this pull request may close these issues.

2 participants