Browse Source

Make tag autocomplete suggestions case-insensitive

Since tags are all lowercase, no suggestions would be found if the user
typed in any uppercase letters. This converts to lowercase and fixes
that issue.
merge-requests/68/head
Deimos 5 years ago
parent
commit
03454abc94
  1. 2
      tildes/static/js/behaviors/autocomplete-input.js

2
tildes/static/js/behaviors/autocomplete-input.js

@ -125,7 +125,7 @@ $.onmount('[data-js-autocomplete-input]', function() {
} }
var $tagsHiddenInput = $('[data-js-autocomplete-hidden-input]'); var $tagsHiddenInput = $('[data-js-autocomplete-hidden-input]');
var suggestions = $this.data('js-autocomplete-input').filter(function(suggestion) { var suggestions = $this.data('js-autocomplete-input').filter(function(suggestion) {
return suggestion.startsWith($this.val()) &&
return suggestion.startsWith($this.val().toLowerCase()) &&
!$tagsHiddenInput.val().match(new RegExp('(^|,)' + suggestion + ',')); !$tagsHiddenInput.val().match(new RegExp('(^|,)' + suggestion + ','));
}); });
if (suggestions.length === 0) { if (suggestions.length === 0) {

Loading…
Cancel
Save