Update lib/src/Components/Input/Autocomplete.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Anton Tranelis 2025-12-16 21:13:04 +01:00 committed by GitHub
parent f53c02ead9
commit a5f5ba738a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -110,7 +110,19 @@ export const Autocomplete = ({
className={`tw:absolute tw:z-4000 ${filteredSuggestions.length > 0 ? 'tw:bg-base-100 tw:rounded-xl tw:p-2' : ''}`}
>
{filteredSuggestions.map((suggestion, index) => (
<li key={suggestion.id} onClick={() => handleSuggestionClick(suggestion)}>
<li
key={suggestion.id}
role="option"
tabIndex={0}
aria-selected={index === highlightedSuggestion}
onClick={() => handleSuggestionClick(suggestion)}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
handleSuggestionClick(suggestion);
}
}}
>
<TagView heighlight={index === highlightedSuggestion} tag={suggestion}></TagView>
</li>
))}