[frontend/components] Add Escape and Enter to SelectDialog
This commit is contained in:
parent
12f4267d01
commit
37ec177e69
1 changed files with 14 additions and 1 deletions
|
@ -5,7 +5,7 @@
|
||||||
@inject IJSRuntime Js;
|
@inject IJSRuntime Js;
|
||||||
@inject IStringLocalizer<Localization> Loc;
|
@inject IStringLocalizer<Localization> Loc;
|
||||||
|
|
||||||
<dialog class="dialog" @ref="Dialog">
|
<dialog @onkeydown="HandleKeyDown" class="dialog" @ref="Dialog">
|
||||||
<div class="select @(Waiting ? "waiting" : "")">
|
<div class="select @(Waiting ? "waiting" : "")">
|
||||||
@if (Waiting)
|
@if (Waiting)
|
||||||
{
|
{
|
||||||
|
@ -71,6 +71,19 @@
|
||||||
await CloseDialog();
|
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()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
_module = await Js.InvokeAsync<IJSObjectReference>("import",
|
_module = await Js.InvokeAsync<IJSObjectReference>("import",
|
||||||
|
|
Loading…
Add table
Reference in a new issue