Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@matomo.org>2019-08-19 04:34:54 +0300
committerThomas Steur <tsteur@users.noreply.github.com>2019-08-19 04:34:54 +0300
commite2679a35f48c076447d83da73d97edeb2e224cbc (patch)
treeaf82c9a3170a08202d5cd686cea2c813d6cd5b46 /plugins/SegmentEditor/javascripts/Segmentation.js
parent9f6197a780eabb0322741b41407af0e4500b7a96 (diff)
Improves keyboard navigation for segment editor (#14757)
* Make it possible to open segments or adding one by pressing enter when element is focued * Allow tabbing to all visits segment * Improve style of tab focused segments
Diffstat (limited to 'plugins/SegmentEditor/javascripts/Segmentation.js')
-rw-r--r--plugins/SegmentEditor/javascripts/Segmentation.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/SegmentEditor/javascripts/Segmentation.js b/plugins/SegmentEditor/javascripts/Segmentation.js
index f406e37d05..ffa2ea9aa2 100644
--- a/plugins/SegmentEditor/javascripts/Segmentation.js
+++ b/plugins/SegmentEditor/javascripts/Segmentation.js
@@ -147,8 +147,8 @@ Segmentation = (function($) {
var html = self.editorTemplate.find("> .listHtml").clone();
var segment, injClass;
var listHtml = '<li data-idsegment="" ' +
- (self.currentSegmentStr == "" ? " class='segmentSelected' tabindex='4' " : "")
- + ' data-definition=""><span class="segname">' + self.translations['SegmentEditor_DefaultAllVisits']
+ (self.currentSegmentStr == "" ? " class='segmentSelected'" : "")
+ + ' data-definition=""><span class="segname" tabindex="4">' + self.translations['SegmentEditor_DefaultAllVisits']
+ ' ' + self.translations['General_DefaultAppended']
+ '</span></li> ';
@@ -414,6 +414,14 @@ Segmentation = (function($) {
showAddNewSegmentForm();
});
+ // emulate a click when pressing enter on one of the segments or the add button
+ self.target.on("keyup", ".segmentList li, .add_new_segment", function (event) {
+ var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.key));
+ if(keycode == '13'){
+ $(this).trigger('click');
+ }
+ });
+
// attach event that will clear segment list filtering input after clicking x
self.target.on('click', ".segmentFilterContainer span", function (e) {
$(e.target).parent().find(".segmentFilter").val(self.translations['General_Search']).trigger('keyup');