fix: resolve Svelte build warnings

- Add keyboard handler to fab-modal and dialog overlays (a11y)
- Remove unused .btn-cancel CSS selector
- Wrap meal name input inside its label, use span for ingredients heading
- Change image-wrap-desktop from div to figure for valid figcaption
This commit is contained in:
2026-04-06 00:06:58 +02:00
parent 43c8b3da2e
commit c2510855c5
4 changed files with 17 additions and 18 deletions

View File

@@ -84,12 +84,12 @@
</script>
<div class="sticky-image-layout" class:overlay={mode === 'overlay'}>
<div class="image-wrap-desktop">
<figure class="image-wrap-desktop">
<img {src} {alt}>
{#if caption}
<figcaption class="image-caption">{@html caption}</figcaption>
{/if}
</div>
</figure>
<PipImage {pip} {src} {alt} visible={inView} bind:el={pipEl} />
<div class="content-scroll" bind:this={contentEl}>
{@render children()}
@@ -109,6 +109,7 @@
}
.image-wrap-desktop {
display: none;
margin: 0;
}
.image-caption {
font-size: 0.8rem;

View File

@@ -188,8 +188,8 @@
{#if showDialog}
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div class="dialog-overlay" onclick={() => showDialog = false} onkeydown={(e) => e.key === 'Escape' && (showDialog = false)}>
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div class="dialog" onclick={(e) => e.stopPropagation()}>
<!-- svelte-ignore a11y_no_static_element_interactions a11y_click_events_have_key_events -->
<div class="dialog" onclick={(e) => e.stopPropagation()} onkeydown={(e) => e.stopPropagation()}>
<div class="dialog-header">
<h3>{labels.addToLog}</h3>
<button class="close-btn" onclick={() => showDialog = false}><X size={18} /></button>

View File

@@ -792,7 +792,7 @@
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div class="fab-overlay" onclick={closeFabModal} onkeydown={(e) => e.key === 'Escape' && closeFabModal()}>
<!-- svelte-ignore a11y_no_static_element_interactions a11y_click_events_have_key_events -->
<div class="fab-modal" onclick={(e) => e.stopPropagation()}>
<div class="fab-modal" onclick={(e) => e.stopPropagation()} onkeydown={(e) => e.stopPropagation()}>
<div class="fab-modal-header">
<h3>{t('add_food', lang)}</h3>
<button class="fab-close" onclick={closeFabModal}><Plus size={18} style="transform: rotate(45deg)" /></button>
@@ -1596,8 +1596,7 @@
cursor: not-allowed;
transform: none;
}
.btn-secondary,
.btn-cancel {
.btn-secondary {
padding: 0.5rem 1.1rem;
background: var(--color-bg-tertiary);
color: var(--color-text-primary);
@@ -1608,9 +1607,6 @@
font-weight: 500;
transition: background 0.15s;
}
.btn-cancel:hover {
background: var(--color-bg-elevated);
}
/* ── Day Total ── */
/* ── FAB Modal ── */

View File

@@ -172,16 +172,18 @@
<div class="form-card">
<h2 class="form-title">{editingId ? t('edit', lang) : t('new_meal', lang)}</h2>
<label class="field-label">{t('meal_name', lang)}</label>
<input
type="text"
class="text-input"
bind:value={mealName}
placeholder={t('meal_name', lang)}
/>
<label class="field-label">
{t('meal_name', lang)}
<input
type="text"
class="text-input"
bind:value={mealName}
placeholder={t('meal_name', lang)}
/>
</label>
<!-- Ingredients list -->
<label class="field-label">{t('ingredients', lang)} ({ingredients.length})</label>
<span class="field-label">{t('ingredients', lang)} ({ingredients.length})</span>
{#if ingredients.length > 0}
<div class="ingredients-list">
{#each ingredients as ing, i}