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

Autocompletion starting with Uppercase Letter #49

Closed
bodinsamuel opened this issue Feb 25, 2013 · 4 comments
Closed

Autocompletion starting with Uppercase Letter #49

bodinsamuel opened this issue Feb 25, 2013 · 4 comments
Milestone

Comments

@bodinsamuel
Copy link

When the dalatist present some word starting by an upper case letter, the user type in lowercase and complete it with tab, the first letter will not be changed but the rest of the word is still well completed (I mean with upper case)

ie:
data given = Coca-Cola
data typed = co

user do tab

data displayed = coca-Cola

Don't know if it's a real issue but it's a bit annoying. Doesn't occur with other shortcut.

@jharding
Copy link
Contributor

That's the expected behavior. Pressing tab to complete the query and selecting a suggestion from the dropdown, while resulting in similar outcomes, are 2 different actions. For the former you are completing your query based on the hint and for the latter, you are explicitly selecting a suggestion to be your query.

If others think this behavior is strange, I'm willing to consider changing it, but for now I'm inclined to leave it as is.

@fkammer
Copy link

fkammer commented Feb 26, 2013

In my opinion both action should have the same result. Autocomplete suggests the first dropdown item as hint so it would be nice, if pressing tab has the same result as choosing the item from the dropdown list.

@bodinsamuel
Copy link
Author

@jharding It the way you explain it's perfectly logic, and a great option for users, but some may want to be same result.
That's why I don't consider it an issue but just a missing feature :)

@fkammer
Copy link

fkammer commented Feb 26, 2013

What about adding some preferences so the user can set an individual function for these actions?
Like this:

$('input.twitter-search').typeahead({
  data: [{
      name: 'accounts',
      prefetch: 'https://twitter.com/network.json',
      remote: 'https://twitter.com/accounts?q=%QUERY'
    },
    {
      name: 'trends',
      prefetch: 'https://twitter.com/trends.json'
    }
  ],
  onTab: function() {
    // action performed on tab
    // e.g. open the link given by the first object in dropdown
  },
  onClick: function() {
    // action performed when user clicks on a dropdown item
  }
});

If onTab and onClick isn't set the default function is used and it behaves like it do now.

Of course this would be a feature for the next major release, but in my opinion it would make typeahead.js more flexible and I think it would make it easier for you to add some features that should be optional like turning of autocomplete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants