Skip to content

Commit

Permalink
Merge pull request #1183 from valadas/dnn-autocomplete-show-suggestions
Browse files Browse the repository at this point in the history
dnn-autocomplete, allow showing suggestions upon click
  • Loading branch information
david-poindexter authored Sep 30, 2024
2 parents 2ea99a1 + 8e095f3 commit f96e4c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ export class DnnAutocomplete {
return itemHeight * upcomingItems;
}

private handleDropdownClick(): void {
this.handleSearchQueryChanged(this.value);
}

@Debounce(100)
private handleSuggestionsScroll(): void {
const container = this.suggestionsContainer;
Expand Down Expand Up @@ -380,7 +384,7 @@ export class DnnAutocomplete {
}
</ul>
<svg
onClick={() => this.focused = !this.focused}
onClick={() => this.handleDropdownClick()}
class="chevron-down"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 -960 960 960">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,7 @@ export class DnnExampleForm {
required
suggestions={this.filteredUsers}
onSearchQueryChanged={e => {
if (e.detail == undefined || e.detail == "")
{
this.filteredUsers = [];
return;
}
const search = (e.detail as string).toLowerCase();
const search = (e.detail || "" as string).toLowerCase();
this.filteredUsers = this.users.filter(u => u.label.toLowerCase().includes(search));
}}
renderSuggestion={suggestion =>
Expand Down

0 comments on commit f96e4c8

Please sign in to comment.