Skip to content

🎨 Palette: Add accessibility props to Button and RippleButton#170

Open
mknoufi wants to merge 1 commit into
mainfrom
feat/palette-button-a11y-7856181833105527864
Open

🎨 Palette: Add accessibility props to Button and RippleButton#170
mknoufi wants to merge 1 commit into
mainfrom
feat/palette-button-a11y-7856181833105527864

Conversation

@mknoufi
Copy link
Copy Markdown
Owner

@mknoufi mknoufi commented May 10, 2026

User description

💡 What: Added explicit accessibility properties (accessibilityRole, accessibilityLabel, accessibilityHint, and dynamic accessibilityState) to the reusable Button and RippleButton UI components.
🎯 Why: Custom action buttons implemented with TouchableOpacity fail to announce their function, disabled state, or loading state (busy) to screen reader users unless these props are explicitly passed down. This ensures all buttons across the application (especially icon-only variants) are fully accessible.
📸 Before/After: N/A (non-visual structural change)
♿ Accessibility: Ensures correct semantic roles, announces loading/disabled states to screen readers, and guarantees a label is always present for interactive touch targets.


PR created automatically by Jules for task 7856181833105527864 started by @mknoufi


CodeAnt-AI Description

Add screen reader labels and state to shared buttons

What Changed

  • Shared buttons now announce their purpose to screen readers with a label, hint, and button/link role.
  • Buttons now expose disabled and loading state so assistive tech can tell when an action is unavailable or in progress.
  • If no label is provided, the button text is used as the spoken label, which helps icon-only and reused buttons stay accessible.

Impact

✅ Clearer screen reader announcements
✅ Accessible icon-only buttons
✅ Fewer confusion during loading or disabled actions

🔄 Retrigger CodeAnt AI Review

Details

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Adds support for `accessibilityRole`, `accessibilityLabel`, and `accessibilityHint` to the generic `Button` and `RippleButton` components. Automatically manages the `accessibilityState` based on the existing `disabled` and `loading` props to ensure screen readers correctly interpret the interactive states.

Co-authored-by: mknoufi <209227354+mknoufi@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

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

@qodo-code-review
Copy link
Copy Markdown

ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one.

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 10, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@sonarqubecloud
Copy link
Copy Markdown

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label May 10, 2026
Comment on lines +294 to +296
accessibilityLabel={
accessibilityLabel || label || (typeof children === "string" ? children : undefined)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The accessibility label fallback can still resolve to undefined when the button is icon-only or when children is not a plain string, so assistive technologies may announce an unlabeled interactive control. Ensure a guaranteed non-empty label is always derived (for example by requiring accessibilityLabel when there is no textual label). [incomplete implementation]

Severity Level: Critical 🚨
- ❌ RippleButton can render unlabeled interactive controls.
- ⚠️ Screen readers cannot identify icon-only RippleButton actions.
Steps of Reproduction ✅
1. Open `frontend/src/components/ui/RippleButton.tsx` and note the props interface at
lines 47–63, where `icon` is optional, `label` is optional, `children` is optional, and
`accessibilityLabel` is optional, enabling icon-only usage without any textual props.

2. Observe the JSX for the ghost/outline branch at lines 285–301 where
`<TouchableOpacity>` is rendered with `accessibilityLabel={ accessibilityLabel || label ||
(typeof children === "string" ? children : undefined) }` (lines 293–296 in the PR diff):
if all three values are absent or non-string, this expression evaluates to `undefined`.

3. Consider a typical consumer of this reusable button (for example, any screen that
imports the default export from `frontend/src/components/ui/RippleButton.tsx:106`) and
renders an icon-only control like `<RippleButton icon="add" variant="ghost" />` without
providing `accessibilityLabel`, `label`, or string `children` – a usage explicitly
supported by the `icon` prop and the existing `content` rendering at lines 219–247.

4. Run the app with a screen using such an icon-only `RippleButton`, enable
VoiceOver/TalkBack, and focus the button: React Native will see `accessibilityLabel` as
`undefined` on the `TouchableOpacity`, so assistive technology announces an unlabeled
button (only the generic role), leaving screen reader users with an interactive control
that has no spoken name.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** frontend/src/components/ui/RippleButton.tsx
**Line:** 294:296
**Comment:**
	*Incomplete Implementation: The accessibility label fallback can still resolve to `undefined` when the button is icon-only or when `children` is not a plain string, so assistive technologies may announce an unlabeled interactive control. Ensure a guaranteed non-empty label is always derived (for example by requiring `accessibilityLabel` when there is no textual `label`).

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 10, 2026

CodeAnt AI finished reviewing your PR.

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

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant