From 37ec177e698a65f1f36eb9e15dfc7a6f3a57b62f Mon Sep 17 00:00:00 2001 From: pancakes Date: Fri, 21 Feb 2025 19:16:11 +1000 Subject: [PATCH] [frontend/components] Add Escape and Enter to SelectDialog --- Iceshrimp.Frontend/Components/SelectDialog.razor | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Iceshrimp.Frontend/Components/SelectDialog.razor b/Iceshrimp.Frontend/Components/SelectDialog.razor index 76f128a6..1fad0136 100644 --- a/Iceshrimp.Frontend/Components/SelectDialog.razor +++ b/Iceshrimp.Frontend/Components/SelectDialog.razor @@ -5,7 +5,7 @@ @inject IJSRuntime Js; @inject IStringLocalizer Loc; - +
@if (Waiting) { @@ -71,6 +71,19 @@ await CloseDialog(); } + private async Task HandleKeyDown(KeyboardEventArgs e) + { + if (e is { Code: "Enter" }) + { + if (!Waiting) await ConfirmAction(); + } + + if (e is { Code: "Escape" }) + { + if (!Waiting) await CancelAction(); + } + } + protected override async Task OnInitializedAsync() { _module = await Js.InvokeAsync("import",