Browse Source

allow enter key to submit add to collection dialog (#167)

pull/168/head
Jason Dove 5 years ago committed by GitHub
parent
commit
a854294cb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      ErsatzTV/Shared/AddToCollectionDialog.razor

15
ErsatzTV/Shared/AddToCollectionDialog.razor

@ -7,7 +7,8 @@ @@ -7,7 +7,8 @@
@inject ISnackbar Snackbar
@inject ILogger<AddToCollectionDialog> Logger
<MudDialog>
<div @onkeydown="@OnKeyDown">
<MudDialog>
<DialogContent>
<MudContainer Class="mb-6">
<MudHighlighter Class="mud-primary-text"
@ -34,7 +35,9 @@ @@ -34,7 +35,9 @@
Add To Collection
</MudButton>
</DialogActions>
</MudDialog>
</MudDialog>
</div>
@code {
@ -109,4 +112,12 @@ @@ -109,4 +112,12 @@
private void Cancel() => MudDialog.Cancel();
private async Task OnKeyDown(KeyboardEventArgs e)
{
if (e.Code is "Enter" or "NumpadEnter" && CanSubmit())
{
await Submit();
}
}
}
Loading…
Cancel
Save