Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add option to show all Typeahead items #2043

Closed
reefdog opened this Issue · 5 comments

6 participants

Justin Reese F A T Reed G. Law Gabriel Farrell Mark Otto Philipp
Justin Reese

Currently, the menu of items doesn't appear until you start typing. Normally this is fine, but sometimes I'd like the user to see the sorts of items in the list before typing.

I propose adding an option which, if set to true, goes ahead and shows the menu (along with first items number of items) as soon as the Typeahead input is focused. This option would default false to match current behavior.

So in the State example, when the input was focused, the menu would open and show Alabama through Delaware (assuming items was left at default 8). This prompts the user for the sort of string we're expecting them to type.

One could argue "but if we pop open a list of items, they may think that's all the items that are offered" which could be negated by #2042.

F A T
Admin

Tagging this as a feature request

Matthew Urtnowski Murtnowski referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Matthew Urtnowski Murtnowski referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Matthew Urtnowski Murtnowski referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Matthew Urtnowski Murtnowski referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Matthew Urtnowski Murtnowski referenced this issue from a commit in Murtnowski/bootstrap
Matthew Urtnowski Murtnowski Resolved Issue #2043
Added variable focusshow which defaults to false

When focusshow is true, it makes it so when you gain focus on typeahead it causes the menu to show up.

I added a focus listener to catch when the typeahead gains focus
I added a method called showmenu when will show then menu when typeahead gains focus
1386772
Matthew Urtnowski Murtnowski referenced this issue from a commit in Murtnowski/bootstrap
Matthew Urtnowski Murtnowski Resolved Issue #2043
Added variable focusshow which defaults to false

When focusshow is true, it makes it so when you gain focus on typeahead it causes the menu to show up.

I added a focus listener to catch when the typeahead gains focus
I added a method called showmenu when will show then menu when typeahead gains focus
a64bdd2
Matthew Urtnowski Murtnowski referenced this issue from a commit in Murtnowski/bootstrap
Matthew Urtnowski Murtnowski Resolved Issue #2043
Added variable focusshow which defaults to false

When focusshow is true, it makes it so when you gain focus on typeahead it causes the menu to show up.

I added a focus listener to catch when the typeahead gains focus
I added a method called showmenu when will show then menu when typeahead gains focus
d8eaab7
Reed G. Law

A possibly related issue is that typeahead hides ajax results that should be shown if the search term is not an exact substring of the results. For example, typing "lax" using Google Places Autocomplete returns "L.A.X., Los Angeles, CA, United States" as the first result but this will not be shown because "lax" doesn't have dots after each letter. So if there was an option to always show 5 items regardless of exact match it might solve this problem.

Gabriel Farrell gsf referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Gabriel Farrell gsf referenced this issue from a commit in gsf/bootstrap
Gabriel Farrell gsf Added showAll option to show all items on focus 9b760c1
Gabriel Farrell gsf referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Gabriel Farrell gsf referenced this issue from a commit in gsf/bootstrap
Gabriel Farrell gsf Added showAll option to show all items on focus 8041b2d
Gabriel Farrell

Apologies, I should have left those refs out of the commit. The pull requests (one for master and one for 2.1.0-wip) add a test and functionality for a "showAll" option. When it's true the typeahead shows all items in the source, up to the number in the "items" option, on focus. As you can see in the commit, only 6 lines of code are affected.

Now I'm thinking "focusShow" (as suggested in #2474) might be a more descriptive name for the option.

Michael Cox michaelcox referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Michael Cox michaelcox referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Mark Otto
Admin
mdo commented

Closing as a dupe of #2042.

Mark Otto mdo closed this
Philipp

I've built an extension to bootstrap's typeahead plugin to provide the behavior you are looking for. Have a look here: https://github.com/ptnplanet/Bootstrap-Better-Typeahead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.