Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 2024-05-17 - Add aria-label to theme toggle buttons

**Learning:** Found that empty icon buttons (like theme selectors) generated via Rust server-side templates (`pkgs/id/src/web/templates.rs`) were missing `aria-label` attributes, though they had `title` attributes. Missing these on icon-only interactive elements is a common accessibility anti-pattern.
**Action:** When working on server-rendered templates, especially for interactive elements like theme buttons or inline tools, always verify that `aria-label` attributes are included alongside `title` to ensure they are fully accessible to screen readers.
18 changes: 9 additions & 9 deletions pkgs/id/src/web/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ pub fn render_main_page_wrapper(content: &str) -> String {
html.push_str(" <a href=\"/peers\" data-nav class=\"crt-glow\">peers</a>\n");
html.push_str(" <a href=\"/settings\" data-nav class=\"crt-glow\">settings</a>\n");
html.push_str(" <span class=\"flex items-center gap-1\">\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"sneak\" title=\"Sneak theme\"></button>\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"arch\" title=\"Arch theme\"></button>\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"mech\" title=\"Mech theme\"></button>\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"sneak\" title=\"Sneak theme\" aria-label=\"Sneak theme\"></button>\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"arch\" title=\"Arch theme\" aria-label=\"Arch theme\"></button>\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"mech\" title=\"Mech theme\" aria-label=\"Mech theme\"></button>\n");
html.push_str(" </span>\n");
html.push_str(" </nav>\n");
html.push_str(" </header>\n");
Expand Down Expand Up @@ -458,9 +458,9 @@ pub fn render_editor(doc_id: &str, name: &str, content: &str, hash: &str) -> Str
html.push_str(" <a href=\"/peers\" data-nav>peers</a>\n");
html.push_str(" <a href=\"/settings\" data-nav>settings</a>\n");
html.push_str(" <span class=\"flex items-center gap-1\">\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"sneak\" title=\"Sneak theme\"></button>\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"arch\" title=\"Arch theme\"></button>\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"mech\" title=\"Mech theme\"></button>\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"sneak\" title=\"Sneak theme\" aria-label=\"Sneak theme\"></button>\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"arch\" title=\"Arch theme\" aria-label=\"Arch theme\"></button>\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"mech\" title=\"Mech theme\" aria-label=\"Mech theme\"></button>\n");
html.push_str(" </span>\n");
html.push_str(" </nav>\n");
html.push_str(" </div>\n");
Expand Down Expand Up @@ -719,9 +719,9 @@ pub fn render_settings(node_id: &str) -> String {
html.push_str(" <h3 class=\"mt-8\">Theme</h3>\n");
html.push_str(" <p class=\"text-muted mb-4\">Choose your preferred visual theme.</p>\n");
html.push_str(" <div class=\"flex gap-4\">\n");
html.push_str(" <button class=\"theme-btn btn btn-sm btn-outline btn-primary\" data-theme=\"sneak\">Sneak</button>\n");
html.push_str(" <button class=\"theme-btn btn btn-sm btn-outline btn-primary\" data-theme=\"arch\">Arch</button>\n");
html.push_str(" <button class=\"theme-btn btn btn-sm btn-outline btn-primary\" data-theme=\"mech\">Mech</button>\n");
html.push_str(" <button class=\"theme-btn btn btn-sm btn-outline btn-primary\" data-theme=\"sneak\" aria-label=\"Sneak theme\">Sneak</button>\n");
html.push_str(" <button class=\"theme-btn btn btn-sm btn-outline btn-primary\" data-theme=\"arch\" aria-label=\"Arch theme\">Arch</button>\n");
html.push_str(" <button class=\"theme-btn btn btn-sm btn-outline btn-primary\" data-theme=\"mech\" aria-label=\"Mech theme\">Mech</button>\n");
html.push_str(" </div>\n");
html.push_str(" \n");
html.push_str(" <h3 class=\"mt-8\">Keyboard Shortcuts</h3>\n");
Expand Down
Loading