Question

I have a problem with Typeahead when I'm using mobile Phones and Tablets with virtual keyboard.

When I tap the typeahead control (a html input), the virtual keyboard appears and I can input a query text. Then a dropdown displays the results, and when I select an option, virtual keyboard is closed and the chosen option is displayed in the control. But inmediately the virtual keyboard is displayed again, because the focus returns to the typeahead control and triggers the tap event again.

The example on Bootstrap page has the same behavior.

[EDIT] The user must select several options, When selects the first, I want to set focus in the next option control, but typeahead return the focus to itself. I can't Set focus just after select. Thats only occurs with Boostrap. jquery autocomplete for example works properly.

Can anyone help me?

Thanks

Was it helpful?

Solution

In bootstrap-typeahead.js v2.3.0 into Typeahead.prototype, "Click" function, after selecting a item, sets focus to "input control" again. That is not necesary. So I removed that code line and now typeahead is working fine with all mobile and tablets browsers.

...
     , click: function (e) {
          e.stopPropagation()
          e.preventDefault()
          this.select()
          //this.$element.focus() //I removed this line
      }
...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top