-
Notifications
You must be signed in to change notification settings - Fork 0
🎨 Palette: Improve notification close button accessibility and focus styles #954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| ## 2024-06-13 - [Accessibility] Screen readers pronouncing decorative emojis | ||
| **Learning:** Screen readers often misinterpret standalone emojis (e.g., ⬇️, 🗑️) inside buttons, reading them literally, which creates redundant or confusing announcements when a descriptive `aria-label` is already present. | ||
| **Action:** Always wrap non-informational emojis or text-based icons in `<span aria-hidden="true">` when the parent interactive element already has a sufficiently descriptive label. | ||
| ## 2025-04-03 - Improved Notification Close Button Accessibility and Focus Styles | ||
| **Learning:** Decorative characters like "✕" inside buttons that already have `aria-label` attributes can cause redundant or confusing announcements for screen reader users. Additionally, using the `:focus` pseudo-class for buttons triggers focus outlines even on mouse clicks, which can add unnecessary visual noise. | ||
| **Action:** When implementing icon-only buttons with decorative characters, wrap the visual character in `<span aria-hidden="true">` to rely entirely on the `aria-label`. Use `:focus-visible` instead of `:focus` for interactive elements to ensure focus outlines appear only during keyboard navigation. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,4 +94,4 @@ | |
| "vitest": "^4.1.2", | ||
| "web-streams-polyfill": "^4.2.0" | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -281,8 +281,8 @@ | |||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| /* Focus states for accessibility */ | ||||||||||||||||||||||||||||||||
| .notification-action-btn:focus, | ||||||||||||||||||||||||||||||||
| .notification-close-btn:focus { | ||||||||||||||||||||||||||||||||
| .notification-action-btn:focus-visible, | ||||||||||||||||||||||||||||||||
| .notification-close-btn:focus-visible { | ||||||||||||||||||||||||||||||||
| outline: 2px solid #667eea; | ||||||||||||||||||||||||||||||||
| outline-offset: 2px; | ||||||||||||||||||||||||||||||||
|
Comment on lines
+284
to
287
|
||||||||||||||||||||||||||||||||
| .notification-action-btn:focus-visible, | |
| .notification-close-btn:focus-visible { | |
| outline: 2px solid #667eea; | |
| outline-offset: 2px; | |
| @supports selector(:focus-visible) { | |
| .notification-action-btn:focus-visible, | |
| .notification-close-btn:focus-visible { | |
| outline: 2px solid #667eea; | |
| outline-offset: 2px; | |
| } | |
| .notification-action-btn:focus:not(:focus-visible), | |
| .notification-close-btn:focus:not(:focus-visible) { | |
| outline: none; | |
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -202,8 +202,9 @@ const NotificationItem: React.FC<NotificationItemProps> = ({ | |||||
| className="notification-close-btn" | ||||||
| onClick={handleRemove} | ||||||
| aria-label="Close notification" | ||||||
| title="Close" | ||||||
|
||||||
| title="Close" | |
| title="Close notification" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new palette entry date looks off relative to the PR date (
<current_datetime>is 2026-04-03). If this entry is meant to reflect this change, update the heading date accordingly to avoid a misleading historical log.