[frontend/components] Add Escape and Enter keybinds to NoticeDialog
This commit is contained in:
parent
df5dcab581
commit
04425aab9d
1 changed files with 9 additions and 1 deletions
|
@ -6,7 +6,7 @@
|
|||
@inject IJSRuntime Js;
|
||||
@inject IStringLocalizer<Localization> Loc;
|
||||
|
||||
<dialog class="dialog" @ref="Dialog">
|
||||
<dialog @onkeydown="HandleKeyDown" class="dialog" @ref="Dialog">
|
||||
<div class="notice">
|
||||
<span class="notice-icon">
|
||||
@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()
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue