[frontend] Code cleanup

This commit is contained in:
Laura Hausmann 2024-07-11 02:49:07 +02:00
parent d5ce61d901
commit e64e81baf2
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
3 changed files with 4 additions and 7 deletions

View file

@ -1,4 +1,3 @@
using System.ComponentModel;
using Iceshrimp.Shared.Schemas.Web;
namespace Iceshrimp.Frontend.Core.Services;

View file

@ -1,6 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using Iceshrimp.Shared.Schemas.Web;
using Microsoft.AspNetCore.Components;
namespace Iceshrimp.Frontend.Core.Services.StateServicePatterns;

View file

@ -6,7 +6,7 @@
@implements IDisposable
@inject NavigationManager Navigation;
<div @ref="a" @onfocusout="Close" class="sidebar @(_open ? "open" : "")" tabindex=0>
<div @ref="SidebarElementRef" @onfocusout="Close" class="sidebar @(_open ? "open" : "")" tabindex=0>
<div class="header">
<account-dropdown/>
</div>
@ -71,7 +71,7 @@
@code {
private Compose _compose = null!;
private bool _open = false;
private ElementReference a { get; set; }
private ElementReference SidebarElementRef { get; set; }
private async void Open()
{
@ -80,8 +80,7 @@
private void ToggleSidebar()
{
if (_open) _open = false;
else _open = true;
_open = !_open;
StateHasChanged();
}
@ -99,7 +98,7 @@
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (_open) await a.FocusAsync();
if (_open) await SidebarElementRef.FocusAsync();
}
protected override void OnInitialized()