fix: resolve all linter errors and a11y warnings
CI / test (push) Has been cancelled
CI / docker-build (push) Has been cancelled
CI / lint-and-check (push) Has been cancelled

- Fix TS errors: editMode property order, implicit any, string|undefined
- Add $state() to bind:this element refs (IconGrid, EntityPicker, etc.)
- Fix a11y: labels, aria-labels, roles, tabindex on dialogs
- Remove unused imports (tick, svelte-i18n)
- Make AutocompleteInput/TagsInput accept optional string values
This commit is contained in:
2026-04-10 19:05:25 +03:00
parent f96cbbca56
commit 44e1849821
20 changed files with 59 additions and 33 deletions
@@ -133,6 +133,7 @@
<h3 class="mb-3 text-sm font-semibold text-card-foreground">{$t('admin.perm_title')}</h3>
<div class="grid grid-cols-1 gap-3 sm:grid-cols-5">
<div>
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="mb-1 block text-xs text-muted-foreground">{$t('admin.perm_entity_type')}</label>
<IconGrid
items={entityTypeItems}
@@ -142,6 +143,7 @@
/>
</div>
<div>
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="mb-1 block text-xs text-muted-foreground">{$t('admin.perm_entity')}</label>
<EntityPicker
items={entityPickerItems}
@@ -151,6 +153,7 @@
/>
</div>
<div>
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="mb-1 block text-xs text-muted-foreground">{$t('admin.perm_target_type')}</label>
<IconGrid
items={targetTypeItems}
@@ -160,6 +163,7 @@
/>
</div>
<div>
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="mb-1 block text-xs text-muted-foreground">{$t('admin.perm_target')}</label>
<EntityPicker
items={targetPickerItems}
@@ -169,6 +173,7 @@
/>
</div>
<div>
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="mb-1 block text-xs text-muted-foreground">{$t('admin.perm_level')}</label>
<div class="flex gap-1">
<div class="flex-1">
+1
View File
@@ -227,6 +227,7 @@
{#if $form.healthcheckEnabled}
<div class="grid grid-cols-1 gap-4 sm:grid-cols-3">
<div>
<!-- svelte-ignore a11y_label_has_associated_control -->
<label
class="mb-1 block text-sm font-medium text-card-foreground"
>
@@ -39,6 +39,7 @@
</script>
<div class="space-y-2">
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="block text-sm font-medium text-card-foreground">{$t('app.icon')}</label>
<div class="flex gap-2">
@@ -144,6 +144,7 @@
<button
type="button"
onclick={() => removeLink(link.id)}
aria-label="Remove link"
class="flex-shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive"
>
<svg class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
@@ -91,6 +91,7 @@
<button
type="button"
onclick={onClose}
aria-label="Close"
class="rounded-lg p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
>
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -111,6 +112,7 @@
<!-- Icon -->
<div>
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="mb-1 block text-sm font-medium text-foreground">{$t('app.icon') ?? 'Icon'}</label>
<IconPickerButton value={icon} onchange={(v) => { icon = v; }} />
</div>
@@ -148,10 +148,11 @@
<svelte:window onkeydown={handleKeydown} />
<!-- Backdrop -->
<!-- svelte-ignore a11y_click_events_have_key_events a11y_no_static_element_interactions -->
<!-- svelte-ignore a11y_click_events_have_key_events -->
<div
class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"
onclick={handleBackdropClick}
role="presentation"
>
<div class="mx-4 w-full max-w-lg rounded-xl border border-border bg-card p-6 shadow-xl" role="dialog" aria-modal="true">
<!-- Header -->
@@ -4,8 +4,8 @@
import SearchResult from './SearchResult.svelte';
import { goto } from '$app/navigation';
let inputEl: HTMLInputElement;
let resultsEl: HTMLDivElement;
let inputEl: HTMLInputElement = $state() as HTMLInputElement;
let resultsEl: HTMLDivElement = $state() as HTMLDivElement;
$effect(() => {
if (search.open && inputEl) {
@@ -68,10 +68,11 @@
</script>
{#if search.open}
<!-- svelte-ignore a11y_no_static_element_interactions -->
<!-- svelte-ignore a11y_click_events_have_key_events -->
<div
class="fixed inset-0 z-50 flex items-start justify-center bg-black/50 pt-[15vh] backdrop-blur-sm"
onclick={handleBackdropClick}
role="presentation"
style="animation: searchFadeIn 0.15s ease-out"
>
<!-- Dialog -->
@@ -80,6 +80,7 @@
<div class="space-y-3">
{#if label}
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="block text-sm font-medium text-foreground">{label}</label>
{/if}
@@ -154,6 +154,7 @@
<!-- Hue slider -->
<div class="mb-4">
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="mb-1.5 block text-sm text-muted-foreground">{$t('settings.hue')}</label>
<div class="relative">
<div
@@ -174,7 +175,8 @@
<!-- Saturation slider -->
<div>
<label class="mb-1.5 block text-sm text-muted-foreground">{$t('settings.saturation')}</label>
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="mb-1.5 block text-sm text-muted-foreground">{$t('settings.saturation')}</label>
<div class="relative">
<div
class="h-3 w-full rounded-full"
@@ -1,10 +1,8 @@
<script lang="ts">
import { tick } from 'svelte';
interface Props {
id?: string;
name?: string;
value: string;
value: string | undefined;
suggestions: string[];
placeholder?: string;
class?: string;
@@ -25,7 +23,7 @@
let containerEl: HTMLDivElement | undefined = $state();
const filtered = $derived.by(() => {
const q = value.trim().toLowerCase();
const q = (value ?? '').trim().toLowerCase();
if (!q) return suggestions;
return suggestions.filter((s) => s.toLowerCase().includes(q));
});
@@ -46,6 +46,7 @@
onclick={(e) => e.stopPropagation()}
transition:scale={{ start: 0.95, duration: 150 }}
role="alertdialog"
tabindex="-1"
aria-labelledby="confirm-dialog-title"
aria-describedby="confirm-dialog-message"
>
+2 -2
View File
@@ -34,8 +34,8 @@
let open = $state(false);
let query = $state('');
let highlightIdx = $state(0);
let listEl: HTMLDivElement;
let inputEl: HTMLInputElement;
let listEl = $state<HTMLDivElement>();
let inputEl = $state<HTMLInputElement>();
const selectedItem = $derived(items.find((i) => i.value === value));
+3 -2
View File
@@ -21,8 +21,8 @@
$props();
let open = $state(false);
let triggerEl: HTMLButtonElement;
let popupEl: HTMLDivElement;
let triggerEl = $state<HTMLButtonElement>();
let popupEl = $state<HTMLDivElement>();
let filterQuery = $state('');
const selectedItem = $derived(items.find((i) => i.value === value));
@@ -135,6 +135,7 @@
>
{#if showFilter}
<div class="border-b border-border px-3 py-2">
<!-- svelte-ignore a11y_autofocus -->
<input
type="text"
bind:value={filterQuery}
+4 -6
View File
@@ -1,10 +1,8 @@
<script lang="ts">
import { t } from 'svelte-i18n';
interface Props {
id?: string;
name?: string;
value: string;
value: string | undefined;
suggestions: string[];
placeholder?: string;
class?: string;
@@ -25,11 +23,11 @@
let containerEl: HTMLDivElement | undefined = $state();
// Parse comma-separated tags
const tags = $derived(value.split(',').map((t) => t.trim()).filter(Boolean));
const tags = $derived((value ?? '').split(',').map((t) => t.trim()).filter(Boolean));
// Get the current partial tag being typed (after last comma)
const currentPartial = $derived.by(() => {
const parts = value.split(',');
const parts = (value ?? '').split(',');
return parts[parts.length - 1]?.trim() ?? '';
});
@@ -53,7 +51,7 @@
function selectItem(item: string) {
// Replace the current partial with the selected tag
const parts = value.split(',').map((p) => p.trim());
const parts = (value ?? '').split(',').map((p) => p.trim());
parts[parts.length - 1] = item;
value = parts.join(',') + ',';
open = false;
@@ -196,6 +196,7 @@
{/if}
{:else if cardSize === 'large'}
<!-- Large: icon + name + description + sparkline + tags + links -->
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
class="card-hover group rounded-xl {cardStyleClass} p-5 transition-colors hover:border-primary/50"
data-app-widget
@@ -291,6 +292,7 @@
</div>
{:else}
<!-- Medium (default): icon + name + status + sparkline on hover + links -->
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
class="card-hover group rounded-xl {cardStyleClass} p-4 transition-colors hover:border-primary/50"
data-app-widget
@@ -363,6 +363,7 @@
<div class="mb-3 rounded-lg border border-border bg-muted/50 p-3">
<!-- Widget Type Selector (Icon Grid) -->
<div class="mb-3">
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="mb-1 block text-sm font-medium text-foreground">
Widget Type
</label>
@@ -376,6 +377,7 @@
<!-- Type-specific config forms -->
{#if selectedWidgetType === 'app'}
<div>
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="mb-1 block text-sm font-medium text-foreground">
{$t('widget.select_app')}
</label>
@@ -434,6 +436,7 @@
{:else if selectedWidgetType === 'note'}
<div class="space-y-3">
<div>
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="mb-1 block text-sm font-medium text-foreground">Format</label>
<IconGrid
items={noteFormatItems}
@@ -516,6 +519,7 @@
{:else if selectedWidgetType === 'clock'}
<div class="space-y-3">
<div>
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="mb-1 block text-sm font-medium text-foreground">Clock Style</label>
<IconGrid
items={clockStyleItems}
@@ -760,6 +764,7 @@
/>
</div>
<div>
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="mb-1 block text-sm font-medium text-foreground">Source Type</label>
<IconGrid
items={metricSourceItems}