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
3 changes: 3 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2024-05-18 - Add aria-labels to raw inputs and buttons
**Learning:** Found a pattern of missing `aria-label` attributes on raw `<input>` and icon-only `<button>` elements in the Rust-based server-rendered HTML templates (`pkgs/id/src/web/templates.rs`).
**Action:** Always ensure that icon-only buttons and raw inputs generated from server templates have appropriate `aria-label` attributes for accessibility.
1 change: 0 additions & 1 deletion .github/workflows/auto-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
assignees: dezren39
numOfAssignee: 1
28 changes: 14 additions & 14 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\" aria-label=\"Sneak theme\" title=\"Sneak theme\"></button>\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"arch\" aria-label=\"Arch theme\" title=\"Arch theme\"></button>\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"mech\" aria-label=\"Mech theme\" title=\"Mech theme\"></button>\n");
html.push_str(" </span>\n");
html.push_str(" </nav>\n");
html.push_str(" </header>\n");
Expand Down Expand Up @@ -142,7 +142,7 @@ pub fn render_file_list(page: &FileListPage) -> String {
);
html.push_str("<div class=\"flex items-center gap-2 px-3 py-2 border-b border-base-300\">");
html.push_str("<form id=\"new-file-form\" onsubmit=\"window.idApp?.createFile?.(event); return false;\" class=\"contents\">");
html.push_str("<input type=\"text\" id=\"new-file-name\" name=\"name\" placeholder=\"filename.md\" required class=\"input input-bordered input-xs flex-1 bg-base-100\" />");
html.push_str("<input type=\"text\" id=\"new-file-name\" name=\"name\" aria-label=\"New file name\" placeholder=\"filename.md\" required class=\"input input-bordered input-xs flex-1 bg-base-100\" />");
html.push_str(
"<button type=\"submit\" class=\"btn btn-ghost btn-xs font-mono\">create</button>",
);
Expand All @@ -160,7 +160,7 @@ pub fn render_file_list(page: &FileListPage) -> String {
let _ = write!(
html,
"<input type=\"text\" id=\"file-search\" class=\"input input-bordered input-xs flex-1 bg-base-100\" name=\"search\" \
placeholder=\"search files & tags...\" autocomplete=\"off\" \
aria-label=\"Search files and tags\" placeholder=\"search files & tags...\" autocomplete=\"off\" \
value=\"{}\" />",
search_value
);
Expand Down Expand Up @@ -202,10 +202,10 @@ pub fn render_file_list_content(page: &FileListPage) -> String {
"<div class=\"flex items-center gap-2 px-3 py-2 border-b border-base-300 text-xs\" id=\"bulk-action-bar\" style=\"display:none;\">",
);
html.push_str("<span class=\"font-bold\" id=\"bulk-count\">0 selected</span>");
html.push_str("<input type=\"text\" id=\"bulk-tag-key\" class=\"input input-bordered input-xs w-24 bg-base-100\" placeholder=\"key\" />");
html.push_str("<input type=\"text\" id=\"bulk-tag-value\" class=\"input input-bordered input-xs w-24 bg-base-100\" placeholder=\"value (optional)\" />");
html.push_str("<input type=\"text\" id=\"bulk-tag-key\" class=\"input input-bordered input-xs w-24 bg-base-100\" aria-label=\"Tag key\" placeholder=\"key\" />");
html.push_str("<input type=\"text\" id=\"bulk-tag-value\" class=\"input input-bordered input-xs w-24 bg-base-100\" aria-label=\"Tag value\" placeholder=\"value (optional)\" />");
html.push_str("<button class=\"btn btn-ghost btn-xs font-mono\" onclick=\"window.idApp?.bulkAddTag?.()\">+ add tag</button>");
html.push_str("<button class=\"btn btn-ghost btn-xs font-mono text-base-content/50\" onclick=\"window.idApp?.bulkClearSelection?.()\">clear</button>");
html.push_str("<button class=\"btn btn-ghost btn-xs font-mono text-base-content/50\" aria-label=\"Clear selection\" onclick=\"window.idApp?.bulkClearSelection?.()\">clear</button>");
html.push_str("</div>");

html.push_str("<ul class=\"list-none m-0 p-0\">");
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\" aria-label=\"Sneak theme\" title=\"Sneak theme\"></button>\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"arch\" aria-label=\"Arch theme\" title=\"Arch theme\"></button>\n");
html.push_str(" <button class=\"theme-btn\" data-theme=\"mech\" aria-label=\"Mech theme\" title=\"Mech theme\"></button>\n");
html.push_str(" </span>\n");
html.push_str(" </nav>\n");
html.push_str(" </div>\n");
Expand All @@ -472,9 +472,9 @@ pub fn render_editor(doc_id: &str, name: &str, content: &str, hash: &str) -> Str
html.push_str(" <span class=\"font-bold text-base-content/50\">tags:</span>\n");
html.push_str(" <span class=\"flex gap-1 flex-wrap\" id=\"editor-tag-list\"></span>\n");
html.push_str(" <span class=\"flex items-center gap-1\" id=\"tag-add-inline\">\n");
html.push_str(" <input type=\"text\" id=\"tag-add-key\" class=\"input input-bordered input-xs w-20 bg-base-100\" placeholder=\"key\" />\n");
html.push_str(" <input type=\"text\" id=\"tag-add-value\" class=\"input input-bordered input-xs w-20 bg-base-100\" placeholder=\"value\" />\n");
html.push_str(" <button class=\"btn btn-ghost btn-xs font-mono\" onclick=\"window.idApp?.addTagInline?.()\">+</button>\n");
html.push_str(" <input type=\"text\" id=\"tag-add-key\" class=\"input input-bordered input-xs w-20 bg-base-100\" aria-label=\"Tag key\" placeholder=\"key\" />\n");
html.push_str(" <input type=\"text\" id=\"tag-add-value\" class=\"input input-bordered input-xs w-20 bg-base-100\" aria-label=\"Tag value\" placeholder=\"value\" />\n");
html.push_str(" <button class=\"btn btn-ghost btn-xs font-mono\" aria-label=\"Add tag\" onclick=\"window.idApp?.addTagInline?.()\">+</button>\n");
html.push_str(" </span>\n");
html.push_str(" </div>\n");

Expand Down
Loading
Loading