From 3c273feb1855cb37e1245e2341cd26e4480a16ed Mon Sep 17 00:00:00 2001
From: Jon Seager
Date: Mon, 9 Feb 2026 19:56:11 +0000
Subject: [PATCH] feat(a11y): add ARIA attributes, token colors, toast, and
tab-switch links
Add aria-required to required inputs, role=alert to error messages,
aria-label to icon-only list nav buttons, and progressbar ARIA to bag
status bars. Replace hardcoded red/green colors with error/success
design tokens across all templates. Add toast notifications for entity
creation and tab-switch links for empty add-form states. Increase scan
upload body limit to 10MB.
---
src/application/routes/api/mod.rs | 10 +-
templates/base.html | 34 +++++
templates/pages/add.html | 118 +++++++++++++++---
templates/pages/admin.html | 23 ++--
templates/pages/bag.html | 2 +-
templates/pages/brew.html | 2 +-
templates/pages/cafe.html | 2 +-
templates/pages/checkin.html | 28 ++---
templates/pages/cli_callback.html | 4 +-
templates/pages/cup.html | 2 +-
templates/pages/gear.html | 2 +-
templates/pages/home.html | 5 +-
templates/pages/login.html | 3 +-
templates/pages/register.html | 5 +-
templates/pages/roast.html | 2 +-
templates/pages/roaster.html | 2 +-
templates/pages/timeline.html | 7 +-
.../partials/forms/scan_result_form.html | 3 +-
templates/partials/lists/bag_list.html | 11 ++
templates/partials/lists/brew_list.html | 1 +
templates/partials/lists/cafe_list.html | 1 +
templates/partials/lists/cup_list.html | 1 +
templates/partials/lists/gear_list.html | 1 +
templates/partials/lists/roast_list.html | 1 +
templates/partials/lists/roaster_list.html | 1 +
templates/partials/scan_input.html | 3 +-
26 files changed, 213 insertions(+), 61 deletions(-)
diff --git a/src/application/routes/api/mod.rs b/src/application/routes/api/mod.rs
index d9a8e29..0ae2caf 100644
--- a/src/application/routes/api/mod.rs
+++ b/src/application/routes/api/mod.rs
@@ -67,8 +67,14 @@ pub(super) fn router() -> axum::Router {
.route("/nearby-cafes", get(cafes::nearby_cafes))
.route("/extract-roaster", post(roasters::extract_roaster))
.route("/extract-roast", post(roasts::extract_roast_info))
- .route("/extract-bag-scan", post(scan::extract_bag_scan))
- .route("/scan", post(scan::submit_scan))
+ .route(
+ "/extract-bag-scan",
+ post(scan::extract_bag_scan).layer(DefaultBodyLimit::max(10 * 1024 * 1024)),
+ )
+ .route(
+ "/scan",
+ post(scan::submit_scan).layer(DefaultBodyLimit::max(10 * 1024 * 1024)),
+ )
.route("/check-in", post(checkin::submit_checkin))
.route("/cups", get(cups::list_cups).post(cups::create_cup))
.route("/cups/{id}", get(cups::get_cup).delete(cups::delete_cup))
diff --git a/templates/base.html b/templates/base.html
index 2e1cebd..0d544cd 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -48,12 +48,33 @@
type="module"
src="https://cdn.jsdelivr.net/gh/starfederation/datastar@1.0.0-RC.6/bundles/datastar.js"
>
+
{% block head %}{% endblock %}
+
-{% endblock %}
-
{% block content %}
@@ -137,6 +128,7 @@
method="post"
action="/api/v1/roasters"
class="flex flex-col gap-4"
+ onsubmit="sessionStorage.setItem('toast', 'Roaster added')"
>
Add a roast first
- Bags need a roast. Add a roaster and roast to enable this form.
+ Bags need a roast.
+
+ to enable this form.
{% else %}
@@ -427,6 +445,7 @@
method="post"
action="/api/v1/bags"
class="mt-4 flex flex-col gap-4"
+ onsubmit="sessionStorage.setItem('toast', 'Bag added')"
>
@@ -497,14 +517,30 @@
Open a bag first
- Brews need an open bag of coffee. Add a bag to enable this form.
+ Brews need an open bag of coffee.
+
+ to enable this form.
{% else if grinder_options.is_empty() || brewer_options.is_empty() %}
Add gear first
- Brews need a grinder and brewer. Add gear to enable this form.
+ Brews need a grinder and brewer.
+
+ to enable this form.
{% else %}
@@ -516,6 +552,7 @@
method="post"
action="/api/v1/brews"
class="mt-4 flex flex-col gap-6 overflow-hidden pb-16 md:pb-0"
+ onsubmit="sessionStorage.setItem('toast', 'Brew added')"
>
@@ -568,6 +605,7 @@
step="any"
min="1"
required
+ aria-required="true"
class="input-field flex-1 text-center"
data-bind:_brew-weight
/>
@@ -616,6 +654,7 @@