diff --git a/ui/widgets/nuxeo-selectivity.js b/ui/widgets/nuxeo-selectivity.js index c4d076260..993309dc7 100644 --- a/ui/widgets/nuxeo-selectivity.js +++ b/ui/widgets/nuxeo-selectivity.js @@ -2435,7 +2435,11 @@ typedArrayTags[weakMapTag] = false; let resultsHtml = isFilteredResultNotEmpty ? this.renderItems(filteredResults) : ''; if (options.hasMore) { resultsHtml += this.selectivity.template('loadMore'); - } else if (value && Array.isArray(value) && value.includes(options?.term?.toLowerCase())) { + } else if ( + value && + Array.isArray(value) && + value.includes(options && options.term ? options.term.toLowerCase() : options.term) + ) { resultsHtml = this.selectivity.template('tagExists'); } else if (!resultsHtml && !options.add) { resultsHtml = this.selectivity.template('noResults', { term: options.term }); diff --git a/ui/widgets/nuxeo-tag-suggestion.js b/ui/widgets/nuxeo-tag-suggestion.js index 5b1294fbb..3b9444321 100644 --- a/ui/widgets/nuxeo-tag-suggestion.js +++ b/ui/widgets/nuxeo-tag-suggestion.js @@ -237,7 +237,7 @@ import { escapeHTML } from './nuxeo-selectivity.js'; } _newEntryFormatter(term) { - term = term?.toLowerCase(); + term = term ? term.toLowerCase() : term; return { id: term, displayLabel: term, newTag: true }; }