mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Autocomplete multiple demos: Don't leave the field when tabbing while the menu is open. Fixes #6661 - Autocomplete: Tab on multiple Autocomplete should not change focus after selecting.
This commit is contained in:
parent
ff4154bb5d
commit
4637695894
@ -22,7 +22,15 @@
|
|||||||
return split( term ).pop();
|
return split( term ).pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
$( "#birds" ).autocomplete({
|
$( "#birds" )
|
||||||
|
// don't navigate away from the field on tab when selecting an item
|
||||||
|
.bind( "keydown", function( event ) {
|
||||||
|
if ( event.keyCode === $.ui.keyCode.TAB &&
|
||||||
|
$( this ).data( "autocomplete" ).menu.active ) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.autocomplete({
|
||||||
source: function( request, response ) {
|
source: function( request, response ) {
|
||||||
$.getJSON( "search.php", {
|
$.getJSON( "search.php", {
|
||||||
term: extractLast( request.term )
|
term: extractLast( request.term )
|
||||||
|
@ -43,7 +43,15 @@
|
|||||||
return split( term ).pop();
|
return split( term ).pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
$( "#tags" ).autocomplete({
|
$( "#tags" )
|
||||||
|
// don't navigate away from the field on tab when selecting an item
|
||||||
|
.bind( "keydown", function( event ) {
|
||||||
|
if ( event.keyCode === $.ui.keyCode.TAB &&
|
||||||
|
$( this ).data( "autocomplete" ).menu.active ) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.autocomplete({
|
||||||
minLength: 0,
|
minLength: 0,
|
||||||
source: function( request, response ) {
|
source: function( request, response ) {
|
||||||
// delegate back to autocomplete, but extract the last term
|
// delegate back to autocomplete, but extract the last term
|
||||||
|
Loading…
Reference in New Issue
Block a user