Skip to content

🎨 Palette: Add semantic button roles to custom clickable TextViews#108

Open
manupawickramasinghe wants to merge 1 commit into
mainfrom
palette-semantic-roles-3351738989600135254
Open

🎨 Palette: Add semantic button roles to custom clickable TextViews#108
manupawickramasinghe wants to merge 1 commit into
mainfrom
palette-semantic-roles-3351738989600135254

Conversation

@manupawickramasinghe
Copy link
Copy Markdown
Member

đź’ˇ What: Added info.className = android.widget.Button::class.java.name to the AccessibilityDelegateCompat configurations for both textView6 (IP address copy) and textView2 (GitHub repository link).
🎯 Why: When setting up custom clickable views using a TextView and an overridden accessibility delegate, the view handles the click and announces the custom action, but it doesn't intrinsically identify itself as a "Button" to the screen reader. This leaves users unaware that the element is interactable as a standard button. By explicitly setting the semantic role, TalkBack correctly announces "Button", giving users clear expectations.
📸 Before/After: No visual changes. This is purely an accessibility layer update.
♿ Accessibility: Fixes an issue where custom interactive text elements failed to announce their correct interactive role, satisfying WCAG guidelines for name, role, and value.


PR created automatically by Jules for task 3351738989600135254 started by @manupawickramasinghe

Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 11, 2026 21:05
@google-labs-jules
Copy link
Copy Markdown

đź‘‹ 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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates accessibility semantics for two custom clickable TextViews in CameraFragment by explicitly setting an accessibility className so TalkBack announces an interactive role, and records the learning in the repo’s Palette log.

Changes:

  • Set AccessibilityNodeInfoCompat.className to android.widget.Button for the IP copy TextView accessibility node.
  • Set AccessibilityNodeInfoCompat.className to android.widget.Button for the GitHub repo TextView accessibility node.
  • Document the “semantic role” guidance in .Jules/palette.md.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
app/src/main/java/com/samsung/android/scan3d/fragments/CameraFragment.kt Adds an explicit accessibility className to make custom clickable text controls announce an interactive role.
.Jules/palette.md Adds a new Palette entry describing the semantic-role approach for custom clickable views.

đź’ˇ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ViewCompat.setAccessibilityDelegate(binding.textView2, object : AccessibilityDelegateCompat() {
override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfoCompat) {
super.onInitializeAccessibilityNodeInfo(host, info)
info.className = android.widget.Button::class.java.name
Comment thread .Jules/palette.md

## 2026-05-11 - Semantic Roles for Custom Clickable Views
**Learning:** When creating custom clickable views (like a `TextView` acting as a button or link) with overridden accessibility delegates, screen readers may not announce their interactive nature correctly, leaving users unaware that the element is clickable.
**Action:** Explicitly assign a semantic role by setting `info.className` (e.g., `info.className = android.widget.Button::class.java.name`) in `onInitializeAccessibilityNodeInfo` to ensure screen readers announce its correct interactive nature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants