From d710cd1f1333be18ee801c032bba019b082b5f6e Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Mon, 4 May 2026 23:42:37 +0000
Subject: [PATCH] Add missing tooltips to icon-only buttons for accessibility
- Adds `android:tooltipText` to match `android:contentDescription` on clear, back, delete, and reorder buttons.
- Improves hover and long-press accessibility on Android API 26+ without affecting screen reader text.
Co-authored-by: dlukt <201112286+dlukt@users.noreply.github.com>
---
.Jules/palette.md | 3 +++
mastodon/src/main/res/layout/alert_invite_link.xml | 3 ++-
mastodon/src/main/res/layout/fragment_onboarding_common.xml | 2 ++
mastodon/src/main/res/layout/onboarding_profile_field.xml | 2 ++
4 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/.Jules/palette.md b/.Jules/palette.md
index d59f55b4f..2a9583abb 100644
--- a/.Jules/palette.md
+++ b/.Jules/palette.md
@@ -36,3 +36,6 @@
## 2024-05-29 - Semantic Role for Clickable Layouts
**Learning:** Clickable `LinearLayout`s (like poll duration/style selectors) are often announced as generic groups by screen readers, hiding their interactive nature. Setting an `AccessibilityDelegate` to define the class name as `android.widget.Button` effectively communicates that the element is actionable.
**Action:** Always verify that custom clickable containers expose a specific role (Button, Spinner, etc.) via `AccessibilityDelegate` or `ViewCompat` to ensure users know they can interact with them.
+## 2024-05-24 - Missing Tooltips on API 26+
+**Learning:** Many icon-only buttons (`ImageButton`, `ImageView`) throughout the app have `android:contentDescription` set but lack a corresponding `android:tooltipText`. This means screen readers will announce them, but users relying on mouse hover or long-press will not see a descriptive text box.
+**Action:** Always add `android:tooltipText` matching `android:contentDescription` on icon-only interactive elements in XML to ensure visual parity with screen reader text.
diff --git a/mastodon/src/main/res/layout/alert_invite_link.xml b/mastodon/src/main/res/layout/alert_invite_link.xml
index a188985b6..64777a496 100644
--- a/mastodon/src/main/res/layout/alert_invite_link.xml
+++ b/mastodon/src/main/res/layout/alert_invite_link.xml
@@ -82,7 +82,8 @@
android:layout_gravity="end|top"
android:src="@drawable/ic_m3_cancel"
android:background="?android:actionBarItemBackground"
- android:contentDescription="@string/clear"/>
+ android:contentDescription="@string/clear"
+ android:tooltipText="@string/clear"/>
\ No newline at end of file
diff --git a/mastodon/src/main/res/layout/fragment_onboarding_common.xml b/mastodon/src/main/res/layout/fragment_onboarding_common.xml
index e717fdc56..0982800a7 100644
--- a/mastodon/src/main/res/layout/fragment_onboarding_common.xml
+++ b/mastodon/src/main/res/layout/fragment_onboarding_common.xml
@@ -59,6 +59,7 @@
android:background="?android:selectableItemBackgroundBorderless"
android:tint="?colorM3OnSurface"
android:contentDescription="@string/back"
+ android:tooltipText="@string/back"
android:src="@drawable/ic_arrow_back"/>
diff --git a/mastodon/src/main/res/layout/onboarding_profile_field.xml b/mastodon/src/main/res/layout/onboarding_profile_field.xml
index 9700eccca..afb76e48f 100644
--- a/mastodon/src/main/res/layout/onboarding_profile_field.xml
+++ b/mastodon/src/main/res/layout/onboarding_profile_field.xml
@@ -17,6 +17,7 @@
android:scaleType="center"
android:tint="?colorM3OnSurface"
android:contentDescription="@string/reorder"
+ android:tooltipText="@string/reorder"
android:src="@drawable/ic_fluent_re_order_dots_vertical_24_regular"/>