summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2013-11-21 11:55:28 +0600
committerStas Vilchik <vilchiks@gmail.com>2013-11-21 11:55:28 +0600
commit80f3d65d00de35365b6cb7d26bed51122c2b45e6 (patch)
tree5d748be284799cf0c282ea754e6372c6b27385fb
parent6df6db54693dc65d70b4b61aca65bfe62f03ee51 (diff)
downloadsonarqube-80f3d65d00de35365b6cb7d26bed51122c2b45e6.tar.gz
sonarqube-80f3d65d00de35365b6cb7d26bed51122c2b45e6.zip
SONAR-4851 Fix arrows behavior
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/ajax-select-filters.js12
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/select-filters.js4
2 files changed, 14 insertions, 2 deletions
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/filters/ajax-select-filters.js b/sonar-server/src/main/webapp/javascripts/navigator/filters/ajax-select-filters.js
index c5c32459044..8284c8d8e23 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/filters/ajax-select-filters.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/filters/ajax-select-filters.js
@@ -88,8 +88,9 @@ window.SS = typeof window.SS === 'object' ? window.SS : {};
throttledScroll = _.throttle(scroll, 1000);
this.$('.navigator-filter-search input')
- .off('keyup')
- .on('keyup', debouncedKeyup);
+ .off('keyup keydown')
+ .on('keyup', debouncedKeyup)
+ .on('keydown', this.keydown);
this.$('.choices')
.off('scroll')
@@ -122,6 +123,7 @@ window.SS = typeof window.SS === 'object' ? window.SS : {};
}
},
+
scroll: function() {
var el = this.$('.choices'),
scrollBottom = el.scrollTop() >=
@@ -133,6 +135,12 @@ window.SS = typeof window.SS === 'object' ? window.SS : {};
},
+ keydown: function(e) {
+ if (_([37, 38, 39, 40, 32, 13]).indexOf(e.keyCode) !== -1) {
+ e.preventDefault();
+ }
+ },
+
resetChoices: function() {
this.options.filterView.choices.reset([]);
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/filters/select-filters.js b/sonar-server/src/main/webapp/javascripts/navigator/filters/select-filters.js
index 2a287262986..c754f72030c 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/filters/select-filters.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/filters/select-filters.js
@@ -100,12 +100,16 @@ window.SS = typeof window.SS === 'object' ? window.SS : {};
onKeyDown: function(e) {
switch (e.keyCode) {
case 38:
+ e.preventDefault();
this.selectPrevChoice();
break;
case 40:
+ e.preventDefault();
this.selectNextChoice();
break;
case 32:
+ case 13:
+ e.preventDefault();
this.selectCurrent();
break;
}