]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5167 It should be possible to use "Tab" to navigate in the new search forms
authorStas Vilchik <vilchiks@gmail.com>
Fri, 4 Apr 2014 07:38:03 +0000 (13:38 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Fri, 4 Apr 2014 07:38:12 +0000 (13:38 +0600)
sonar-server/src/main/js/measures/app.js
sonar-server/src/main/js/navigator/filters/choice-filters.js
sonar-server/src/main/js/navigator/filters/filter-bar.js
sonar-server/src/main/js/navigator/filters/more-criteria-filters.js

index 830a6cf4eb4536f15348d508c5c745f5fc58204f..96623fccfebbbed1d3ab2399e152400c9366713b 100644 (file)
@@ -191,5 +191,6 @@ requirejs(
       if (window.queryParams) {
         NavigatorApp.filterBarView.restoreFromQuery(window.queryParams);
       }
+      key.setScope('list');
 
     });
index cf74a21562e5b8979863917a00e7d51c6b7e8868..ecc8ba6f4e92e875b265f15fa09740034f531e2c 100644 (file)
@@ -163,7 +163,8 @@ define(['handlebars', 'navigator/filters/base-filters', 'common/handlebars-exten
 
 
     selectCurrent: function() {
-      this.$('label').eq(this.currentChoice).click();
+      var cb = this.$('input[type=checkbox]').eq(this.currentChoice);
+      cb.prop('checked', !cb.prop('checked')).trigger('change');
     },
 
 
index 6f98ba5b05809f795d23c0d2dc8b96b7bd6dd10e..300646c56505de7a665e7bc83b0290b9bfb17146 100644 (file)
@@ -43,9 +43,17 @@ define(
           key.filter = function(e) {
             var el = jQuery(e.target),
                 tabbableSet = el.closest('.navigator-filter-details-inner').find(':tabbable');
-            return tabbableSet.index(el) >= tabbableSet.length - 1;
+            if (el.is(':input')) {
+              if (e.keyCode === 9 || e.keyCode === 27) {
+                return tabbableSet.index(el) >= tabbableSet.length - 1;
+              } else {
+                return false;
+              }
+            } else {
+              return true;
+            }
           };
-          key('f', function() {
+          key('tab', 'list', function() {
             key.setScope('filters');
             that.selectFirst();
             return false;
@@ -58,6 +66,11 @@ define(
             that.selectNext();
             return false;
           });
+          key('escape', 'filters', function() {
+            that.hideDetails();
+            this.selected = -1;
+            key.setScope('list');
+          });
         },
 
 
@@ -90,6 +103,7 @@ define(
             this.selected++;
             filters.eq(this.selected).click();
           } else {
+            this.selected = filters.length;
             this.hideDetails();
             this.$('.navigator-filter-submit').focus();
           }
index a1b2887ebf1ead846443d7194c49f25f367cad46..3bfed0fe484600a3e8405bf08ad8da04cff01569 100644 (file)
@@ -17,6 +17,11 @@ define(['navigator/filters/base-filters', 'navigator/filters/choice-filters', 'c
     },
 
 
+    selectCurrent: function() {
+      this.$('label').eq(this.currentChoice).click();
+    },
+
+
     serializeData: function() {
       var filters = this.model.get('filters').map(function(filter) {
             return _.extend(filter.toJSON(), { id: filter.cid });