From 03454abc94e4cfa07e48e963a225678cf92c86fd Mon Sep 17 00:00:00 2001 From: Deimos Date: Thu, 25 Apr 2019 16:37:25 -0600 Subject: [PATCH] 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. --- tildes/static/js/behaviors/autocomplete-input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tildes/static/js/behaviors/autocomplete-input.js b/tildes/static/js/behaviors/autocomplete-input.js index bb6cd3f..a2509a7 100644 --- a/tildes/static/js/behaviors/autocomplete-input.js +++ b/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 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 + ',')); }); if (suggestions.length === 0) {