🎨 Palette: [a11y] Hide visual text in icon-only buttons from screen readers#281
🎨 Palette: [a11y] Hide visual text in icon-only buttons from screen readers#281Dexploarer wants to merge 1 commit intodevelopfrom
Conversation
…eaders Visual text like "×" inside icon-only buttons was being read aloud redundantly. Wrapped visual characters in `<span aria-hidden="true">` and added a missing aria-label to the delete conversation button.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the accessibility of icon-only buttons for screen reader users. It addresses issues where decorative visual text characters were redundantly announced by screen readers, and ensures that a critical delete button is properly labeled. These changes improve the user experience for individuals relying on assistive technologies without altering the visual interface. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
| onClick={() => removeImage(i)} | ||
| className="absolute -top-1.5 -right-1.5 w-4 h-4 rounded-full bg-danger text-white text-[10px] flex items-center justify-center opacity-100 sm:opacity-0 sm:group-hover:opacity-100 focus-visible:opacity-100 transition-opacity cursor-pointer" |
There was a problem hiding this comment.
Using the array index as both the React key (line 424) and as the identifier for removal (here in removeImage(i)) can lead to subtle bugs if the chatPendingImages array is reordered or if images are removed from the middle. This may cause React to misidentify which image is being removed, resulting in incorrect UI updates or removal of the wrong image.
Recommended solution:
- Assign a unique identifier (such as a UUID or a hash of the image data) to each image when it is added.
- Use this unique identifier as the React key and pass it to the
removeImagefunction for precise removal.
Example:
// When adding images:
resolve({ id: uuidv4(), data, mimeType: file.type, name: file.name });
// ...
// In the map:
key={img.id}
onClick={() => removeImage(img.id)}
// ...
// In removeImage:
setChatPendingImages(prev => prev.filter(img => img.id !== id));| setConfirmDeleteId(conv.id); | ||
| }} | ||
| title="Delete conversation" | ||
| aria-label="Delete conversation" | ||
| > | ||
| × | ||
| <span aria-hidden="true">×</span> | ||
| </button> | ||
| )} | ||
| </> |
There was a problem hiding this comment.
Minor UX/Accessibility Concern
The close (×) icon is used for both closing the sidebar (lines 119-123) and for deleting a conversation (lines 226-227). This dual use could confuse users, especially those relying on assistive technologies, as the same symbol represents different actions in different contexts.
Recommendation:
Consider using a trash/bin icon for the delete action to clearly distinguish it from the close action, improving both usability and accessibility.
There was a problem hiding this comment.
Code Review
This pull request improves accessibility for icon-only buttons by hiding decorative text characters from screen readers. The changes in ChatView.tsx and ConversationsSidebar.tsx correctly wrap visual symbols like '×' in a <span> with aria-hidden="true". Additionally, a missing aria-label is added to the delete conversation button, making it accessible. The new documentation in .Jules/palette.md captures this as a best practice. The changes are well-implemented and achieve their goal.
💡 What: Wrapped visual text characters (
×and×) inside icon-only buttons with<span aria-hidden="true">inChatViewandConversationsSidebar, and added a missingaria-labelto the delete conversation button. Added a critical learning to.Jules/palette.md.🎯 Why: Screen readers announce these text symbols literally (e.g., "multiply"), which creates confusing and redundant announcements when the parent button already has a descriptive
aria-label(e.g., "Remove image img.png"). For the delete button, there was noaria-labelat all, rendering it entirely inaccessible to screen readers.📸 Before/After: No visual changes.
♿ Accessibility: Screen readers will now cleanly announce the button's intended action via its
aria-labelwithout reading the visual text character out loud. The delete conversation button is now properly labeled for screen reader users.PR created automatically by Jules for task 14698081337115438542 started by @Dexploarer