Skip to content

Commit f047130

Browse files
Merge pull request #427 from YaroslavOvdii/return-keyaccess
[Feature] Allow users to use the keyboard to get access to the main features of the LFD.
2 parents 1a071d4 + 3b8038f commit f047130

22 files changed

+408
-125
lines changed

js/build.templates.js

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/layout-javascript/agenda-code.js

Lines changed: 70 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,11 @@ DynamicList.prototype.attachObservers = function() {
196196
_this.hideFilterOverlay();
197197
_this.clearFilters();
198198
})
199-
.on('click', '.hidden-filter-controls-filter', function() {
199+
.on('click keydown', '.hidden-filter-controls-filter', function(event) {
200+
if (!_this.Utils.Event.isExecute(event)) {
201+
return;
202+
}
203+
200204
var $filter = $(this);
201205

202206
Fliplet.Analytics.trackEvent({
@@ -275,7 +279,11 @@ DynamicList.prototype.attachObservers = function() {
275279

276280
_this.$container.find('.clear-filters').removeClass('hidden');
277281
})
278-
.on('click', '.list-search-cancel', function() {
282+
.on('click keydown', '.list-search-cancel', function(event) {
283+
if (!_this.Utils.Event.isExecute(event)) {
284+
return;
285+
}
286+
279287
// Hide filters
280288
$(this).removeClass('active');
281289
_this.$container.find('.hidden-filter-controls').removeClass('active');
@@ -349,12 +357,20 @@ DynamicList.prototype.attachObservers = function() {
349357
_this.isSearching = true;
350358
_this.searchData(value);
351359
})
352-
.on('click', '.clear-search', function() {
360+
.on('click keydown', '.clear-search', function(event) {
361+
if (!_this.Utils.Event.isExecute(event)) {
362+
return;
363+
}
364+
353365
_this.$container.find('.new-agenda-list-container').removeClass('searching');
354366
_this.isSearching = false;
355367
_this.searchData('');
356368
})
357-
.on('click', '.go-to-poll', function() {
369+
.on('click keydown', '.go-to-poll', function(event) {
370+
if (!_this.Utils.Event.isExecute(event)) {
371+
return;
372+
}
373+
358374
if (!_this.data.pollEnabled || !_this.data.pollColumn) {
359375
return;
360376
}
@@ -369,7 +385,11 @@ DynamicList.prototype.attachObservers = function() {
369385
entry: entry
370386
});
371387
})
372-
.on('click', '.go-to-survey', function() {
388+
.on('click keydown', '.go-to-survey', function(event) {
389+
if (!_this.Utils.Event.isExecute(event)) {
390+
return;
391+
}
392+
373393
if (!_this.data.surveyEnabled || !_this.data.surveyColumn) {
374394
return;
375395
}
@@ -384,7 +404,11 @@ DynamicList.prototype.attachObservers = function() {
384404
entry: entry
385405
});
386406
})
387-
.on('click', '.go-to-questions', function() {
407+
.on('click keydown', '.go-to-questions', function(event) {
408+
if (!_this.Utils.Event.isExecute(event)) {
409+
return;
410+
}
411+
388412
if (!_this.data.questionsEnabled || !_this.data.questionsColumn) {
389413
return;
390414
}
@@ -425,9 +449,13 @@ DynamicList.prototype.attachObservers = function() {
425449
: 'bookmarks_hide'
426450
});
427451
})
428-
.on('click', '.toggle-agenda, .toggle-bookmarks', function(e) {
452+
.on('click', '.toggle-agenda, .toggle-bookmarks', function(event) {
429453
e.stopPropagation();
430454

455+
if (!_this.Utils.Event.isExecute(event)) {
456+
return;
457+
}
458+
431459
var $toggle = _this.$container.find(e.handleObj.selector);
432460

433461
$toggle.toggleClass('mixitup-control-active');
@@ -456,7 +484,11 @@ DynamicList.prototype.attachObservers = function() {
456484
allowClick = true;
457485
}, 100);
458486
})
459-
.on('click', '.agenda-list-item', function(event) {
487+
.on('click keydown', '.agenda-list-item', function(event) {
488+
if (!_this.Utils.Event.isExecute(event)) {
489+
return;
490+
}
491+
460492
if (_this.isPanning && !_this.allowClick && $(this).hasClass('open')) {
461493
return;
462494
}
@@ -506,7 +538,11 @@ DynamicList.prototype.attachObservers = function() {
506538
});
507539
});
508540
})
509-
.on('click', '.agenda-detail-overlay-close, .agenda-detail-overlay-screen', function(event) {
541+
.on('click keydown', '.agenda-detail-overlay-close, .agenda-detail-overlay-screen', function(event) {
542+
if (!_this.Utils.Event.isExecute(event)) {
543+
return;
544+
}
545+
510546
var result;
511547

512548
if ($(this).hasClass('go-previous-screen')) {
@@ -569,7 +605,11 @@ DynamicList.prototype.attachObservers = function() {
569605
return;
570606
}
571607
})
572-
.on('click', '.agenda-date-selector li', function() {
608+
.on('click keydown', '.agenda-date-selector li', function(event) {
609+
if (!_this.Utils.Event.isExecute(event)) {
610+
return;
611+
}
612+
573613
// prevents clicking the active one
574614
// prevents clicking the placeholder
575615
if ($(this).hasClass('active') || $(this).hasClass('placeholder')) {
@@ -598,7 +638,11 @@ DynamicList.prototype.attachObservers = function() {
598638
return;
599639
}
600640
})
601-
.on('click', '.dynamic-list-add-item', function() {
641+
.on('click keydown', '.dynamic-list-add-item', function(event) {
642+
if (!_this.Utils.Event.isExecute(event)) {
643+
return;
644+
}
645+
602646
if (!_this.data.addEntryLinkAction) {
603647
return;
604648
}
@@ -630,7 +674,11 @@ DynamicList.prototype.attachObservers = function() {
630674
});
631675
}
632676
})
633-
.on('click', '.dynamic-list-edit-item', function() {
677+
.on('click keydown', '.dynamic-list-edit-item', function(event) {
678+
if (!_this.Utils.Event.isExecute(event)) {
679+
return;
680+
}
681+
634682
if (!_this.data.editEntryLinkAction) {
635683
return;
636684
}
@@ -664,7 +712,11 @@ DynamicList.prototype.attachObservers = function() {
664712
});
665713
}
666714
})
667-
.on('click', '.dynamic-list-delete-item', function() {
715+
.on('click keydown', '.dynamic-list-delete-item', function(event) {
716+
if (!_this.Utils.Event.isExecute(event)) {
717+
return;
718+
}
719+
668720
var _that = $(this);
669721
var entryID = $(this).parents('.agenda-item-inner-content').data('entry-id');
670722
var options = {
@@ -726,7 +778,11 @@ DynamicList.prototype.attachObservers = function() {
726778
Fliplet.UI.Actions(options);
727779
});
728780
})
729-
.on('click', '.agenda-detail-overlay .bookmark-wrapper, .search-results-wrapper .bookmark-wrapper', function() {
781+
.on('click keydown', '.agenda-detail-overlay .bookmark-wrapper, .search-results-wrapper .bookmark-wrapper', function(event) {
782+
if (!_this.Utils.Event.isExecute(event)) {
783+
return;
784+
}
785+
730786
var id = $(this).parents('.agenda-detail-wrapper, .agenda-list-item').data('entry-id');
731787
var record = _.find(_this.listItems, { id: id });
732788

0 commit comments

Comments
 (0)