[frontend/components] Keyboard navigation for AttachmentViewer (ISH-641)
This commit is contained in:
parent
e70cb01c5b
commit
6edfc66c3e
1 changed files with 14 additions and 1 deletions
|
@ -2,7 +2,7 @@
|
|||
@using Iceshrimp.Shared.Schemas.Web
|
||||
@inject IJSRuntime Js
|
||||
|
||||
<dialog class="attachment-view" @ref="Dialog">
|
||||
<dialog class="attachment-view" @onkeydown="OnKeyDown" @ref="Dialog">
|
||||
<button @onclick="CloseDialog" @onclick:stopPropagation="true" class="close">
|
||||
<Icon Name="Icons.X" Size="5rem"></Icon>
|
||||
</button>
|
||||
|
@ -40,6 +40,19 @@
|
|||
set => _refs.Add(value);
|
||||
}
|
||||
|
||||
private async Task OnKeyDown(KeyboardEventArgs e)
|
||||
{
|
||||
switch (e.Key)
|
||||
{
|
||||
case "ArrowRight":
|
||||
await Next();
|
||||
break;
|
||||
case "ArrowLeft":
|
||||
await Prev();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private ElementReference Scroller { get; set; }
|
||||
private int ScrollWidth { get; set; }
|
||||
private int ScrollLeft { get; set; }
|
||||
|
|
Loading…
Add table
Reference in a new issue