Skip to content

Comments

🎨 Palette: Improve ChatView accessibility#87

Draft
Dexploarer wants to merge 1 commit intomainfrom
palette-chat-view-a11y-5376162015197212800
Draft

🎨 Palette: Improve ChatView accessibility#87
Dexploarer wants to merge 1 commit intomainfrom
palette-chat-view-a11y-5376162015197212800

Conversation

@Dexploarer
Copy link
Owner

💡 What:

  • Added aria-label to:
    • Voice input button ("Start voice input" / "Stop listening")
    • Chat textarea ("Chat message")
    • Avatar toggle button ("Show avatar" / "Hide avatar")
    • Mute toggle button ("Mute agent voice" / "Unmute agent voice")
    • Send button ("Send message")
    • Stop generation button ("Stop generation")
    • Stop speaking button ("Stop speaking")
  • Added aria-hidden="true" to decorative SVGs within these buttons.
  • Added explicit type="button" to control buttons to prevent accidental form submission and satisfy linter.
  • Removed unused chatMode variable.

🎯 Why:

  • Improves accessibility for screen reader users by providing descriptive labels for icon-only buttons.
  • Enhances semantic correctness of the HTML.
  • Reduces screen reader noise by hiding decorative icons.

📸 Before/After:

  • Visual appearance is unchanged.
  • DOM now includes proper ARIA attributes.

Accessibility:

  • Critical fix for keyboard and screen reader users navigating the chat interface.

PR created automatically by Jules for task 5376162015197212800 started by @Dexploarer

… types

- Add aria-label to all icon-only buttons in ChatView
- Add aria-label to chat textarea
- Add type="button" to control buttons
- Add aria-hidden="true" to decorative SVGs
- Remove unused chatMode variable
@google-labs-jules
Copy link

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions github-actions bot added the ui label Feb 17, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 17, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch palette-chat-view-a11y-5376162015197212800

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment on lines 179 to 189
.find((message) => message.role === "assistant");
if (!latestAssistant || !latestAssistant.text.trim()) return;

queueAssistantSpeech(latestAssistant.id, latestAssistant.text, !chatSending);
queueAssistantSpeech(
latestAssistant.id,
latestAssistant.text,
!chatSending,
);
}, [msgs, chatSending, agentVoiceMuted, queueAssistantSpeech]);

useEffect(() => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential for Repeated Assistant Speech Queuing

The useEffect in this range queues assistant speech whenever msgs, chatSending, agentVoiceMuted, or queueAssistantSpeech change. If these dependencies change rapidly (e.g., due to fast state updates), the same assistant message could be queued multiple times, potentially resulting in overlapping or repeated speech playback.

Recommendation:
Consider tracking the last spoken message ID and only queue speech if the latest assistant message is new or has changed. For example:

const lastSpokenIdRef = useRef<string | null>(null);
useEffect(() => {
  if (agentVoiceMuted) return;
  const latestAssistant = [...msgs].reverse().find((message) => message.role === "assistant");
  if (!latestAssistant || !latestAssistant.text.trim()) return;
  if (lastSpokenIdRef.current === latestAssistant.id) return;
  lastSpokenIdRef.current = latestAssistant.id;
  queueAssistantSpeech(latestAssistant.id, latestAssistant.text, !chatSending);
}, [msgs, chatSending, agentVoiceMuted, queueAssistantSpeech]);

This ensures each assistant message is only queued once.

@gemini-code-assist
Copy link

Summary of Changes

Hello @Dexploarer, 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 the chat interface for screen reader users by adding crucial ARIA attributes to various interactive elements. It also improves the semantic structure of the HTML and includes minor code clean-up, ensuring a more robust and user-friendly experience without altering the visual appearance.

Highlights

  • Accessibility Improvements: Added aria-label attributes to key interactive elements such as the voice input button, chat textarea, avatar toggle, mute toggle, send button, stop generation button, and stop speaking button to provide descriptive labels for screen reader users.
  • Semantic HTML Enhancement: Implemented aria-hidden="true" on decorative SVG icons within buttons to prevent screen readers from announcing redundant information, and explicitly set type="button" on control buttons to improve semantic correctness and prevent unintended form submissions.
  • Code Clean-up: Removed an unused chatMode variable from the ChatView component, contributing to cleaner and more maintainable code.

🧠 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.

Changelog
  • apps/app/src/components/ChatView.tsx
    • Removed unused chatMode variable.
    • Added aria-label to voice input button, chat textarea, avatar toggle button, mute toggle button, send button, stop generation button, and stop speaking button.
    • Added aria-hidden="true" to decorative SVG icons within buttons.
    • Added explicit type="button" to control buttons.
    • Refactored queueAssistantSpeech call for improved readability.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request primarily focuses on enhancing accessibility within the ChatView component by adding type="button" and aria-label attributes to various interactive elements, including buttons for custom actions, avatar visibility, agent voice control, voice input, chat message input, and chat control actions (stop generation, stop speaking, send message). It also includes minor code changes such as removing an unused chatMode variable and reformatting a queueAssistantSpeech function call for better readability. The review comment suggests improving the maintainability of the newly added title and aria-label attributes for the avatar and mute/unmute buttons by defining their label texts in variables to avoid repetition.

Comment on lines +436 to +504
<button
type="button"
className={`w-7 h-7 flex items-center justify-center border rounded cursor-pointer transition-all bg-card ${
avatarVisible
? "border-accent text-accent"
: "border-border text-muted hover:border-accent hover:text-accent"
}`}
onClick={() => setState("chatAvatarVisible", !avatarVisible)}
title={avatarVisible ? "Hide avatar" : "Show avatar"}
aria-label={avatarVisible ? "Hide avatar" : "Show avatar"}
>
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />
<circle cx="12" cy="7" r="4" />
{!avatarVisible && <line x1="3" y1="3" x2="21" y2="21" />}
</svg>
</button>

{/* Mute / unmute agent voice */}
<button
className={`w-7 h-7 flex items-center justify-center border rounded cursor-pointer transition-all bg-card ${
agentVoiceMuted
? "border-border text-muted hover:border-accent hover:text-accent"
: "border-accent text-accent"
}`}
onClick={() => {
const muting = !agentVoiceMuted;
setState("chatAgentVoiceMuted", muting);
if (muting) voice.stopSpeaking();
}}
title={agentVoiceMuted ? "Unmute agent voice" : "Mute agent voice"}
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />
<circle cx="12" cy="7" r="4" />
{!avatarVisible && <line x1="3" y1="3" x2="21" y2="21" />}
</svg>
</button>

{/* Mute / unmute agent voice */}
<button
type="button"
className={`w-7 h-7 flex items-center justify-center border rounded cursor-pointer transition-all bg-card ${
agentVoiceMuted
? "border-border text-muted hover:border-accent hover:text-accent"
: "border-accent text-accent"
}`}
onClick={() => {
const muting = !agentVoiceMuted;
setState("chatAgentVoiceMuted", muting);
if (muting) voice.stopSpeaking();
}}
title={agentVoiceMuted ? "Unmute agent voice" : "Mute agent voice"}
aria-label={
agentVoiceMuted ? "Unmute agent voice" : "Mute agent voice"
}
>
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" />
{agentVoiceMuted ? (
<line x1="23" y1="9" x2="17" y2="15" />
) : (
<>
<path d="M19.07 4.93a10 10 0 0 1 0 14.14" />
<path d="M15.54 8.46a5 5 0 0 1 0 7.07" />
</>
)}
{agentVoiceMuted && <line x1="17" y1="9" x2="23" y2="15" />}
</svg>
</button>
</div>
<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" />
{agentVoiceMuted ? (
<line x1="23" y1="9" x2="17" y2="15" />
) : (
<>
<path d="M19.07 4.93a10 10 0 0 1 0 14.14" />
<path d="M15.54 8.46a5 5 0 0 1 0 7.07" />
</>
)}
{agentVoiceMuted && <line x1="17" y1="9" x2="23" y2="15" />}
</svg>
</button>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve maintainability and avoid repetition, consider defining the label text for these buttons in variables and reusing them for both title and aria-label attributes.

For example:

const avatarButtonLabel = avatarVisible ? 'Hide avatar' : 'Show avatar';
const muteButtonLabel = agentVoiceMuted ? 'Unmute agent voice' : 'Mute agent voice';

// ... in your JSX

<button
  // ... for avatar
  title={avatarButtonLabel}
  aria-label={avatarButtonLabel}
>
  {/* ... */}
</button>

<button
  // ... for mute
  title={muteButtonLabel}
  aria-label={muteButtonLabel}
>
  {/* ... */}
</button>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant