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 {
......
...@@ -61,15 +61,28 @@ ...@@ -61,15 +61,28 @@
} }
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();
if (!activeElements.length) {
// Prevent droplab from opening dropdown // Prevent droplab from opening dropdown
this.dropdownManager.destroyDroplab(); this.dropdownManager.destroyDroplab();
this.search(); this.search();
} }
} }
}
toggleClearSearchButton(e) { toggleClearSearchButton(e) {
if (e.target.value) { if (e.target.value) {
......
...@@ -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