Commit 14cd8f08 authored by Phil Hughes's avatar Phil Hughes

Fixed keyboard navigation not working in filtered search bar

parent 8a6e4152
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/* global droplab */ /* global droplab */
require('../window')(function(w){ require('../window')(function(w){
var whiteListedKeys = [37, 38, 39, 40];
w.droplabFilter = { w.droplabFilter = {
keydownWrapper: function(e){ keydownWrapper: function(e){
...@@ -17,6 +18,10 @@ require('../window')(function(w){ ...@@ -17,6 +18,10 @@ require('../window')(function(w){
return; return;
} }
if (whiteListedKeys.indexOf(e.detail.which) !== -1) {
return;
}
if (config && config.filterFunction && typeof config.filterFunction === 'function') { if (config && config.filterFunction && typeof config.filterFunction === 'function') {
filterFunction = config.filterFunction; filterFunction = config.filterFunction;
} else { } else {
...@@ -57,4 +62,4 @@ module.exports = function(callback) { ...@@ -57,4 +62,4 @@ module.exports = function(callback) {
}; };
},{}]},{},[1])(1) },{}]},{},[1])(1)
}); });
\ No newline at end of file
...@@ -61,13 +61,26 @@ ...@@ -61,13 +61,26 @@
} }
checkForEnter(e) { checkForEnter(e) {
if (e.keyCode === 38 || e.keyCode === 40) {
const selectionStart = this.filteredSearchInput.selectionStart;
e.preventDefault();
this.filteredSearchInput.setSelectionRange(selectionStart, selectionStart);
}
if (e.keyCode === 13) { if (e.keyCode === 13) {
const dropdown = this.dropdownManager.mapping[this.dropdownManager.currentDropdown];
const dropdownEl = dropdown.element;
const activeElements = dropdownEl.querySelectorAll('.dropdown-active');
e.preventDefault(); e.preventDefault();
// Prevent droplab from opening dropdown if (!activeElements.length) {
this.dropdownManager.destroyDroplab(); // Prevent droplab from opening dropdown
this.dropdownManager.destroyDroplab();
this.search(); this.search();
}
} }
} }
......
...@@ -79,6 +79,16 @@ ...@@ -79,6 +79,16 @@
overflow: auto; overflow: auto;
} }
%filter-dropdown-item-btn-hover {
background-color: $dropdown-hover-color;
color: $white-light;
text-decoration: none;
.avatar {
border-color: $white-light;
}
}
.filter-dropdown-item { .filter-dropdown-item {
.btn { .btn {
border: none; border: none;
...@@ -103,13 +113,7 @@ ...@@ -103,13 +113,7 @@
&:hover, &:hover,
&:focus { &:focus {
background-color: $dropdown-hover-color; @extend %filter-dropdown-item-btn-hover;
color: $white-light;
text-decoration: none;
.avatar {
border-color: $white-light;
}
} }
} }
...@@ -131,6 +135,12 @@ ...@@ -131,6 +135,12 @@
} }
} }
.filter-dropdown-item.dropdown-active {
.btn {
@extend %filter-dropdown-item-btn-hover;
}
}
.hint-dropdown { .hint-dropdown {
width: 250px; width: 250px;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment