Browse Source

Fixes #4344 select on keydown now highlights partial selections when using search selection matching the first letters of matched result

pull/4381/head
Jack Lukic 9 years ago
parent
commit
c3d5a720d3
2 changed files with 9 additions and 3 deletions
  1. 10
      src/definitions/modules/dropdown.js
  2. 2
      src/definitions/modules/dropdown.less

10
src/definitions/modules/dropdown.js

@ -1414,8 +1414,7 @@ $.fn.dropdown = function(parameters) {
;
module.set.scrollPosition($nextItem);
if(settings.selectOnKeydown && module.is.single()) {
module.set.activeItem($nextItem);
module.set.selected(module.get.choiceValue($nextItem), $nextItem);
module.set.selectedItem($nextItem);
}
}
event.preventDefault();
@ -2218,6 +2217,12 @@ $.fn.dropdown = function(parameters) {
$item.addClass(className.active);
}
},
partialSearch: function(text) {
var
length = module.get.query().length
;
$search.val( text.substr(0 , length));
},
scrollPosition: function($item, forceScroll) {
var
edgeTolerance = 5,
@ -2291,6 +2296,7 @@ $.fn.dropdown = function(parameters) {
selectedItem: function($item) {
module.debug('Setting user selection to item', $item);
module.remove.activeItem();
module.set.partialSearch(module.get.choiceText($item));
module.set.activeItem($item);
module.set.selected(module.get.choiceValue($item), $item);
},

2
src/definitions/modules/dropdown.less

@ -549,7 +549,7 @@ select.ui.dropdown {
box-shadow: none !important;
cursor: text;
top: 0em;
left: 0em;
left: @textCursorSpacing;
width: 100%;
outline: none;
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);

Loading…
Cancel
Save