diff options
author | Stefan Giehl <stefan@matomo.org> | 2019-08-19 04:34:54 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2019-08-19 04:34:54 +0300 |
commit | e2679a35f48c076447d83da73d97edeb2e224cbc (patch) | |
tree | af82c9a3170a08202d5cd686cea2c813d6cd5b46 /plugins/SegmentEditor/javascripts | |
parent | 9f6197a780eabb0322741b41407af0e4500b7a96 (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')
-rw-r--r-- | plugins/SegmentEditor/javascripts/Segmentation.js | 12 |
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'); |