mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05:00
Merge pull request #1272 from napoleond/2.0-wip
Support tab and enter in typeahead
This commit is contained in:
commit
11d7ef1515
1 changed files with 2 additions and 2 deletions
4
js/bootstrap-typeahead.js
vendored
4
js/bootstrap-typeahead.js
vendored
|
@ -157,6 +157,7 @@
|
||||||
|
|
||||||
case 9: // tab
|
case 9: // tab
|
||||||
case 13: // enter
|
case 13: // enter
|
||||||
|
if (!this.shown) return
|
||||||
this.select()
|
this.select()
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -172,6 +173,7 @@
|
||||||
|
|
||||||
, keypress: function (e) {
|
, keypress: function (e) {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
if (!this.shown) return
|
||||||
|
|
||||||
switch(e.keyCode) {
|
switch(e.keyCode) {
|
||||||
case 9: // tab
|
case 9: // tab
|
||||||
|
@ -181,13 +183,11 @@
|
||||||
break
|
break
|
||||||
|
|
||||||
case 38: // up arrow
|
case 38: // up arrow
|
||||||
if (!this.shown) return
|
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
this.prev()
|
this.prev()
|
||||||
break
|
break
|
||||||
|
|
||||||
case 40: // down arrow
|
case 40: // down arrow
|
||||||
if (!this.shown) return
|
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
this.next()
|
this.next()
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue