From 295c6f0a17600b7e51e62e817186d24c74c00ba9 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 01:48:37 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20add=20missing=20aria-?= =?UTF-8?q?labels=20to=20action=20buttons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add explicit aria-label attributes to save, rename, copy, bulk tag, and clear selection buttons in server-rendered templates. Also add tests to verify aria-label presence. Co-authored-by: dezren39 <11225574+dezren39@users.noreply.github.com> --- .jules/palette.md | 4 ++ pkgs/id/src/web/templates.rs | 94 ++++++++++++++++++++++++++++++++---- 2 files changed, 89 insertions(+), 9 deletions(-) create mode 100644 .jules/palette.md diff --git a/.jules/palette.md b/.jules/palette.md new file mode 100644 index 0000000000..d9b0651bb8 --- /dev/null +++ b/.jules/palette.md @@ -0,0 +1,4 @@ +## 2026-10-30 - Server-Rendered Template Action Buttons Missing ARIA Labels + +**Learning:** Server-rendered HTML templates generating compact/action buttons (like `save`, `rename`, `copy`, or `clear`) often include visual text labels or `title` tooltips but lack explicit `aria-label` attributes. Screen reader users navigating by interactive controls or relying on accessible names need `aria-label` attributes to ensure consistent screen reader announcement across browser environments. +**Action:** When inspecting or adding buttons in Rust HTML templates (`pkgs/id/src/web/templates.rs`), ensure every icon-only or shortened textual action button explicitly defines an `aria-label` describing the action. diff --git a/pkgs/id/src/web/templates.rs b/pkgs/id/src/web/templates.rs index b323295336..e855856b68 100644 --- a/pkgs/id/src/web/templates.rs +++ b/pkgs/id/src/web/templates.rs @@ -204,8 +204,8 @@ pub fn render_file_list_content(page: &FileListPage) -> String { html.push_str("0 selected"); html.push_str(""); html.push_str(""); - html.push_str(""); - html.push_str(""); + html.push_str(""); + html.push_str(""); html.push_str(""); html.push_str("
hello
", "testhash123"); + assert!( + html.contains("aria-label=\"Save document\""), + "save button should have aria-label" + ); + assert!( + html.contains("aria-label=\"Rename file\""), + "rename button should have aria-label" + ); + assert!( + html.contains("aria-label=\"Copy file\""), + "copy button should have aria-label" + ); + } + + #[test] + fn test_render_file_list_bulk_action_buttons_have_aria_labels() { + let page = FileListPage { + total: 1, + files: vec![FileInfo { + name: "test.txt".to_owned(), + display_name: None, + hash: "abc123def456".to_owned(), + size: 1024, + kind: FileKind::Primary, + parent_name: None, + timestamp: None, + created_at: None, + modified_at: None, + tags: vec![], + is_deleted: false, + }], + page: 1, + per_page: 50, + search: None, + show_deleted: false, + }; + let html = render_file_list_content(&page); + assert!( + html.contains("aria-label=\"Add bulk tag\""), + "bulk tag button should have aria-label" + ); + assert!( + html.contains("aria-label=\"Clear file selection\""), + "clear selection button should have aria-label" + ); + } + #[test] fn test_render_editor_has_rename_button() { let html = render_editor("abc123", "test.md", "hello
", "testhash123"); @@ -1323,6 +1373,19 @@ mod tests { // Media viewer rename/copy button tests // ======================================================================== + #[test] + fn test_render_media_viewer_action_buttons_have_aria_labels() { + let html = render_media_viewer("abc123", "photo.jpg", MediaType::Image); + assert!( + html.contains("aria-label=\"Rename file\""), + "media viewer rename button should have aria-label" + ); + assert!( + html.contains("aria-label=\"Copy file\""), + "media viewer copy button should have aria-label" + ); + } + #[test] fn test_render_media_viewer_has_rename_button() { let html = render_media_viewer("abc123", "photo.jpg", MediaType::Image); @@ -1424,6 +1487,19 @@ mod tests { // Binary viewer rename/copy button tests // ======================================================================== + #[test] + fn test_render_binary_viewer_action_buttons_have_aria_labels() { + let html = render_binary_viewer("abc123", "data.bin"); + assert!( + html.contains("aria-label=\"Rename file\""), + "binary viewer rename button should have aria-label" + ); + assert!( + html.contains("aria-label=\"Copy file\""), + "binary viewer copy button should have aria-label" + ); + } + #[test] fn test_render_binary_viewer_has_rename_button() { let html = render_binary_viewer("abc123", "data.bin");