bootstrap-combobox
bootstrap-combobox copied to clipboard
Combobox doesn't scroll
It looks like the combobox won't scroll up with DOWN arrow key after I type in a few keys and the list of filtered items appears. The selection works fine but goes out of the view without scrolling the list up. I have posted a sample image of the problem at http://stackoverflow.com/questions/26094916/arrow-keys-do-not-work-in-bootstrap-combobox.
Same thing happening here. Is there any fix for this?
Hey guys, I made a fix for this, maybe not the best, but here is it:
In the "bootstrap-combobox.js" --not the minified version-- find the "move function" (line 317 on version 1.1.6) and replace the cases for "up arroy key" and "down arrow key" with this:
case 38: // up arrow
var list = $(e.target.nextSibling.children);
var index = 0;
for (var i = 0; i < list.length; i++) {
if ($(list[i]).hasClass('active')) {
index = i;
}
}
if (index <= (this.$menu.scrollTop()/26)) {
this.$menu.scrollTop((index-1)*26)
}
e.preventDefault();
this.prev();
break;
case 40: // down arrow
e.preventDefault();
this.next();
var list = $(e.target.nextSibling.children);
var index = 0;
for (var i = 0; i < list.length; i++) {
if ($(list[i]).hasClass('active')) {
index = i;
}
}
if (index > (this.$menu.scrollTop()/26)+10) {
this.$menu.scrollTop((index-10)*26)
}
break;
We have same problem as well - posted a screenshot in this ticket https://github.com/hawtio/hawtio-forms/issues/2#issuecomment-88054291
I submitted a pull request with a fix. I used a different method than elisamuel40's because that did not work perfektly for me with long lists, due to the hardcoded pixel values.
@lphooge after merging your PR I'm still seeing the issue locally.