Changing the autocomplete search to accept text without accents to match options with accents (#2842)

* Changing the autocomplete search to accept text without accents to match options with accents

* lint fix

* Added upcoming-release-notes
This commit is contained in:
lelemm
2024-06-11 11:53:10 -03:00
committed by GitHub
parent 8b850f1410
commit f606d92c5c
2 changed files with 16 additions and 1 deletions

View File

@@ -92,7 +92,16 @@ export function defaultFilterSuggestion<T extends Item>(
suggestion: T,
value: string,
) {
return getItemName(suggestion).toLowerCase().includes(value.toLowerCase());
return getItemName(suggestion)
.toLowerCase()
.normalize('NFD')
.replace(/\p{Diacritic}/gu, '')
.includes(
value
.toLowerCase()
.normalize('NFD')
.replace(/\p{Diacritic}/gu, ''),
);
}
function defaultFilterSuggestions<T extends Item>(

View File

@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [lelemm]
---
Enhanced autocomplete for languages with accents like Portuguese. Matches search queries regardless of accents.