From a1cc9dec999813a62a54e5c6fef78230e057fc46 Mon Sep 17 00:00:00 2001 From: Egamorf Date: Sun, 18 May 2025 17:05:40 +0200 Subject: [PATCH] Fix text bug dropdown (#56) Reviewed-on: https://gitea.egamorf.com/PRJ-Game-Ideas/game-ideas/pulls/56 --- .../Shared/Components/Search/SearchInput.razor | 1 + .../Shared/Components/SelectSearch/SelectSearch.razor.cs | 8 +++++++- .../GameIdeas.Shared/Constants/GlobalConstants.cs | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor index 410062d..9f9a6d3 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor @@ -7,6 +7,7 @@ placeholder="@Placeholder" disabled="@IsDisable" style="@(IsDisable ? "pointer-events: none" : "")" + onClick="this.select();" @bind=@Text @bind:event="oninput" @bind:after="HandleTextChanged" diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor.cs index 4e78122..c338da0 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor.cs @@ -55,7 +55,8 @@ public partial class SelectSearch { Values = []; Select?.Close(); - await ValuesChanged.InvokeAsync([.. Values]); + SearchInput?.SetText(string.Empty); + await ValuesChanged.InvokeAsync([]); } private void HandleFocusIn() @@ -80,5 +81,10 @@ public partial class SelectSearch )) .ThenBy(game => SelectParams.GetItemLabel(game).Length)]; } + else + { + SelectParams.Items = Items; + SearchInput?.SetText(string.Join(", ", Values?.Select(GetLabel) ?? [])); + } } } \ No newline at end of file diff --git a/src/GameIdeas/GameIdeas.Shared/Constants/GlobalConstants.cs b/src/GameIdeas/GameIdeas.Shared/Constants/GlobalConstants.cs index 0620bdd..801c7cb 100644 --- a/src/GameIdeas/GameIdeas.Shared/Constants/GlobalConstants.cs +++ b/src/GameIdeas/GameIdeas.Shared/Constants/GlobalConstants.cs @@ -22,7 +22,7 @@ public class GlobalConstants public const int API_PORT = 8000; public const string SUB_DOMAIN_NAME = "api-"; - public const double DELAY_INPUT_MS = 500; + public const double DELAY_INPUT_MS = 450; public const int MAX_DESCRIPTION_LENGTH = 350; }