Skip to content

Commit 89e70fd

Browse files
committed
Bug 1169418: Can't enter space in Keyword field
1 parent 00b57b5 commit 89e70fd

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

extensions/BugModal/web/bug_modal.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,20 @@ $(function() {
343343
delimiter: /,\s*/,
344344
minChars: 0,
345345
autoSelectFirst: true,
346+
triggerSelectOnValidInput: false,
346347
formatResult: function(suggestion, currentValue) {
347348
// disable <b> wrapping of matched substring
348349
return suggestion.value.htmlEncode();
349350
},
351+
onSearchStart: function(params) {
352+
var that = $(this);
353+
// adding spaces shouldn't initiate a new search
354+
var parts = that.val().split(/,\s*/);
355+
var query = parts[parts.length - 1];
356+
return query === $.trim(query);
357+
},
350358
onSelect: function() {
359+
this.value = this.value + ', ';
351360
this.focus();
352361
}
353362
});

js/field.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ $(function() {
710710
that.removeClass('autocomplete-running');
711711
if (document.activeElement != this)
712712
that.devbridgeAutocomplete('hide');
713-
};
713+
}
714714

715715
var options_user = {
716716
serviceUrl: 'rest/user',
@@ -724,6 +724,7 @@ $(function() {
724724
minChars: 3,
725725
tabDisabled: true,
726726
autoSelectFirst: true,
727+
triggerSelectOnValidInput: false,
727728
transformResult: function(response) {
728729
response = $.parseJSON(response);
729730
return {
@@ -757,6 +758,7 @@ $(function() {
757758

758759
that.addClass('autocomplete-running');
759760
that.data('counter', that.data('counter') + 1);
761+
return true;
760762
},
761763
onSearchComplete: searchComplete,
762764
onSearchError: searchComplete
@@ -795,11 +797,20 @@ $(function() {
795797
delimiter: /,\s*/,
796798
minChars: 0,
797799
autoSelectFirst: true,
800+
triggerSelectOnValidInput: false,
798801
formatResult: function(suggestion, currentValue) {
799802
// disable <b> wrapping of matched substring
800803
return suggestion.value.htmlEncode();
801804
},
805+
onSearchStart: function(params) {
806+
var that = $(this);
807+
// adding spaces shouldn't initiate a new search
808+
var parts = that.val().split(/,\s*/);
809+
var query = parts[parts.length - 1];
810+
return query === $.trim(query);
811+
},
802812
onSelect: function() {
813+
this.value = this.value + ', ';
803814
this.focus();
804815
}
805816
});

0 commit comments

Comments
 (0)