diff --git a/.Jules/palette.md b/.Jules/palette.md new file mode 100644 index 0000000..aa970af --- /dev/null +++ b/.Jules/palette.md @@ -0,0 +1,3 @@ +## 2025-02-23 - Dynamic ARIA Labels on Icon-only Buttons +**Learning:** Icon-only interactive elements like notification bells often lack context-aware ARIA attributes. A static `aria-label="Notifications"` does not communicate crucial dynamic state (e.g., whether there are unread notifications) to assistive technologies. +**Action:** When creating or updating icon-only buttons that convey state visually (e.g., with a badge or unread count), ensure the `aria-label` dynamically reflects that state (e.g., `"Notifications, 3 unread"` instead of just `"Notifications"`). diff --git a/notification_bell_screenshot.png b/notification_bell_screenshot.png new file mode 100644 index 0000000..86e3630 Binary files /dev/null and b/notification_bell_screenshot.png differ diff --git a/src/components/notifications/notification-bell.tsx b/src/components/notifications/notification-bell.tsx index 318e870..abbe124 100644 --- a/src/components/notifications/notification-bell.tsx +++ b/src/components/notifications/notification-bell.tsx @@ -82,6 +82,7 @@ export function NotificationBell() { variant="ghost" size="icon" className="relative text-foreground/70 hover:text-foreground hover:bg-accent/10" + aria-label={count > 0 ? `Notifications, ${count} unread` : "Notifications"} > {count > 0 && (