Skip to content

Commit

Permalink
dnn-autocomplete, allow showing suggestions upon click
Browse files Browse the repository at this point in the history
Closes dnn-autocomplete, dropdown should show selections #1180
  • Loading branch information
valadas committed Sep 30, 2024
1 parent e9af618 commit 8e095f3
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 8e095f3

Please sign in to comment.