var that = this,
keyup = function(e) {
- if (e.keyCode !== 38 && e.keyCode !== 40) {
+ if (e.keyCode !== 37 && e.keyCode !== 38 && e.keyCode !== 39 && e.keyCode !== 40) {
that.search();
}
},
keydown: function(e) {
- if (_([37, 38, 39, 40, 13]).indexOf(e.keyCode) !== -1) {
+ if (_([38, 40, 13]).indexOf(e.keyCode) !== -1) {
e.preventDefault();
}
},
toggleDetails: function(e) {
e.stopPropagation();
+ this.options.filterBarView.selected = this.options.filterBarView.getEnabledFilters().index(this.$el);
if (this.$el.hasClass('active')) {
key.setScope('list');
this.hideDetails();
} else {
- key.setScope('filter');
+ key.setScope('filters');
this.showDetails();
}
},
that.hideDetails();
});
this.addMoreCriteriaFilter();
+
+ 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;
+ };
+ key('f', function() {
+ key.setScope('filters');
+ that.selectFirst();
+ return false;
+ });
+ key('shift+tab', 'filters', function() {
+ that.selectPrev();
+ return false;
+ });
+ key('tab', 'filters', function() {
+ that.selectNext();
+ return false;
+ });
+ },
+
+
+ getEnabledFilters: function() {
+ return this.$(this.itemViewContainer).children()
+ .not('.navigator-filter-disabled')
+ .not('.navigator-filter-inactive')
+ .not('.navigator-filter-favorite');
+ },
+
+
+ selectFirst: function() {
+ this.selected = -1;
+ this.selectNext();
+ },
+
+
+ selectPrev: function() {
+ var filters = this.getEnabledFilters();
+ if (this.selected > 0) {
+ this.selected--;
+ filters.eq(this.selected).click();
+ }
+ },
+
+
+ selectNext: function() {
+ var filters = this.getEnabledFilters();
+ if (this.selected < filters.length - 1) {
+ this.selected++;
+ filters.eq(this.selected).click();
+ } else {
+ this.hideDetails();
+ this.$('.navigator-filter-submit').focus();
+ }
},
define(['navigator/filters/base-filters', 'navigator/filters/choice-filters', 'common/handlebars-extensions'], function (BaseFilters, ChoiceFilters) {
- var DetailsMoreCriteriaFilterView = BaseFilters.DetailsFilterView.extend({
+ var DetailsMoreCriteriaFilterView = ChoiceFilters.DetailsChoiceFilterView.extend({
template: getTemplate('#more-criteria-details-filter-template'),
var id = $j(e.target).data('id');
this.model.view.options.filterBarView.enableFilter(id);
this.model.view.hideDetails();
+ this.updateCurrent(0);
},