From 04425aab9d5d9aa2f38734e19ae8aca987ed2c21 Mon Sep 17 00:00:00 2001 From: pancakes Date: Fri, 21 Feb 2025 19:06:53 +1000 Subject: [PATCH] [frontend/components] Add Escape and Enter keybinds to NoticeDialog --- Iceshrimp.Frontend/Components/NoticeDialog.razor | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Iceshrimp.Frontend/Components/NoticeDialog.razor b/Iceshrimp.Frontend/Components/NoticeDialog.razor index 6099a185..27d71910 100644 --- a/Iceshrimp.Frontend/Components/NoticeDialog.razor +++ b/Iceshrimp.Frontend/Components/NoticeDialog.razor @@ -6,7 +6,7 @@ @inject IJSRuntime Js; @inject IStringLocalizer Loc; - +
@switch (Type) @@ -56,6 +56,14 @@ await _module.InvokeVoidAsync("openDialog", Dialog); } + + private async Task HandleKeyDown(KeyboardEventArgs e) + { + if (e is { Code: "Enter" or "Escape" }) + { + await CloseDialog(); + } + } protected override async Task OnInitializedAsync() {