🎨 Palette: Add semantic button roles to custom clickable TextViews#108
🎨 Palette: Add semantic button roles to custom clickable TextViews#108manupawickramasinghe wants to merge 1 commit into
Conversation
Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com>
|
đź‘‹ 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. |
There was a problem hiding this comment.
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.classNametoandroid.widget.Buttonfor the IP copyTextViewaccessibility node. - Set
AccessibilityNodeInfoCompat.classNametoandroid.widget.Buttonfor the GitHub repoTextViewaccessibility 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 |
|
|
||
| ## 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. |
đź’ˇ What: Added
info.className = android.widget.Button::class.java.nameto theAccessibilityDelegateCompatconfigurations for bothtextView6(IP address copy) andtextView2(GitHub repository link).🎯 Why: When setting up custom clickable views using a
TextViewand 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