🎨 Palette: Improve compose FAB long-press accessibility discoverability#119
🎨 Palette: Improve compose FAB long-press accessibility discoverability#119
Conversation
Agent-Logs-Url: https://github.com/dlukt/techidon/sessions/9e5a77c2-6b44-4cf9-a830-c338e7e8653a Co-authored-by: dlukt <201112286+dlukt@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds tooltip affordance to the icon-only “new post” compose FAB to improve discoverability and align with existing UI patterns that use android:tooltipText.
Changes:
- Added
android:tooltipText="@string/new_post"to the compose FAB in timeline and shared FAB layouts. - Minor formatting/indentation normalization in
fragment_timeline.xml.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| mastodon/src/main/res/layout/fragment_timeline.xml | Adds tooltip text to the timeline FAB (and normalizes closing tag indentation). |
| mastodon/src/main/res/layout/compose_fab.xml | Adds tooltip text to the reusable compose FAB layout. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| android:contentDescription="@string/new_post" | ||
| android:tooltipText="@string/new_post" | ||
| android:src="@drawable/ic_fluent_compose_24_filled"/> |
There was a problem hiding this comment.
android:tooltipText is unlikely to appear on long-press here because the FAB has an OnLongClickListener (used for account picking when multiple accounts) which typically suppresses the tooltip when the long-click is consumed. If the goal is long-press discoverability, consider adjusting the FAB long-click handling (or showing the affordance via another mechanism) so the tooltip can still be displayed; otherwise this tooltip will mainly help hover/mouse use cases.
| android:stateListAnimator="@animator/fab_shadow" | ||
| android:contentDescription="@string/new_post" | ||
| android:tooltipText="@string/new_post" | ||
| android:src="@drawable/ic_fluent_compose_24_filled" /> |
There was a problem hiding this comment.
Same as in fragment_timeline.xml: this FAB is wired up with an OnLongClickListener in code (account picker when multiple accounts), which commonly prevents tooltips from showing on long-press. If the intent is to improve long-press discoverability, the long-click/tooltip interaction needs to be handled explicitly; otherwise this is primarily a hover tooltip.
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/dlukt/techidon/sessions/926c874f-1358-4775-b24e-410211b4e3f4 Co-authored-by: dlukt <201112286+dlukt@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dlukt/techidon/sessions/926c874f-1358-4775-b24e-410211b4e3f4 Co-authored-by: dlukt <201112286+dlukt@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dlukt/techidon/sessions/926c874f-1358-4775-b24e-410211b4e3f4 Co-authored-by: dlukt <201112286+dlukt@users.noreply.github.com>
Applied in commit 778998b (with the functional change in 6d382a8): I removed the FAB tooltip approach and instead added explicit accessibility long-click action labels on the compose FAB where long-press is consumed by account picker. It now exposes “Add or switch accounts” via |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (AccountSessionManager.getInstance().getLoggedInAccounts().size() > 1) { | ||
| ViewCompat.replaceAccessibilityAction(fab, AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK, getString(R.string.manage_accounts), null); | ||
| } else { | ||
| ViewCompat.replaceAccessibilityAction(fab, AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK, null, null); | ||
| } |
There was a problem hiding this comment.
The long-click accessibility label is set only once during view creation. If the user adds/removes accounts (changing getLoggedInAccounts().size()) while this fragment stays alive (e.g., via account management screens and returning), TalkBack can advertise an out-of-date long-press action label that no longer matches what long-press does. Consider extracting this into an updateFabLongClickAccessibilityAction() method and calling it from a lifecycle callback that runs on return/visibility changes (e.g., onResume()/onShown()), so the label always reflects the current account count.
| if (AccountSessionManager.getInstance().getLoggedInAccounts().size() > 1) { | ||
| ViewCompat.replaceAccessibilityAction(fab, AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK, getString(R.string.manage_accounts), null); | ||
| } else { | ||
| ViewCompat.replaceAccessibilityAction(fab, AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK, null, null); | ||
| } |
There was a problem hiding this comment.
This accessibility action label is computed only at onViewCreated time. If the logged-in account count changes while the fragment remains in the back stack, the ACTION_LONG_CLICK label can become stale (e.g., still announcing “manage accounts” after the user logs out to a single account, even though long-press won’t open the picker). Consider centralizing this logic (e.g., updateFabLongClickAccessibilityAction()) and invoking it from onResume()/onShown() as well, so assistive tech always gets the correct long-press description.
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/dlukt/techidon/sessions/1b4b5413-4505-4b31-bcb1-34ac8ed53058 Co-authored-by: dlukt <201112286+dlukt@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dlukt/techidon/sessions/1b4b5413-4505-4b31-bcb1-34ac8ed53058 Co-authored-by: dlukt <201112286+dlukt@users.noreply.github.com>
Applied in 89e27bb (with the lifecycle refresh extraction in acf9ad5). The compose FAB long-click accessibility action is now centralized in |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mastodon/src/main/java/de/icod/techidon/fragments/HomeTabFragment.java
Outdated
Show resolved
Hide resolved
mastodon/src/main/java/de/icod/techidon/fragments/BaseStatusListFragment.java
Outdated
Show resolved
Hide resolved
…stFragment.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ent.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mastodon/src/main/java/de/icod/techidon/fragments/HomeTabFragment.java
Outdated
Show resolved
Hide resolved
| boolean multipleAccounts = AccountSessionManager.getInstance().getLoggedInAccounts().size() > 1; | ||
|
|
||
| // Only expose a long-click action (including to accessibility services) | ||
| // when there are multiple accounts to manage. | ||
| fab.setLongClickable(multipleAccounts); | ||
| if (!multipleAccounts) { | ||
| fab.setOnLongClickListener(null); | ||
| } |
There was a problem hiding this comment.
updateFabLongClickAccessibilityAction() nulls the FAB’s OnLongClickListener when only one account exists, but doesn’t restore it when multipleAccounts becomes true later (e.g., after adding a second account and returning to the fragment). This leaves long-press permanently broken until the view is recreated. Fix by keeping the listener attached and relying on setLongClickable(false), or reattaching fab.setOnLongClickListener(this::onFabLongClick) when multipleAccounts is true.
There was a problem hiding this comment.
Applied in 688a383. I removed the fab.setOnLongClickListener(null) branch so the long-click listener remains attached, and we rely on fab.setLongClickable(multipleAccounts) plus accessibility-action updates to control exposure. This restores long-press behavior when account count returns to multiple accounts. Screenshot: https://github.com/user-attachments/assets/6ebac5ec-7eee-4818-9052-efcab138219d
…ent.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dlukt/techidon/sessions/2ed82beb-b54c-4425-86d0-1ca04da739dd Co-authored-by: dlukt <201112286+dlukt@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mastodon/src/main/java/de/icod/techidon/fragments/BaseStatusListFragment.java
Outdated
Show resolved
Hide resolved
mastodon/src/main/java/de/icod/techidon/fragments/HomeTabFragment.java
Outdated
Show resolved
Hide resolved
| private void updateFabLongClickAccessibilityAction() { | ||
| if (fab == null) | ||
| return; | ||
|
|
||
| boolean multipleAccounts = AccountSessionManager.getInstance().getLoggedInAccounts().size() > 1; | ||
|
|
There was a problem hiding this comment.
updateFabLongClickAccessibilityAction() duplicates the same logic now present in HomeTabFragment (and partially in other views). To reduce the chance of future drift (e.g., label/resource changes), consider extracting this into a shared helper (e.g., in UiUtils) that takes the target view and label resource.
| fab.setLongClickable(multipleAccounts); | ||
|
|
||
| if (multipleAccounts) { | ||
| ViewCompat.replaceAccessibilityAction( | ||
| fab, | ||
| AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK, | ||
| getString(R.string.manage_accounts), | ||
| null | ||
| ); | ||
| } else { | ||
| ViewCompat.replaceAccessibilityAction( | ||
| fab, | ||
| AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK, | ||
| null, | ||
| null | ||
| ); | ||
| } |
There was a problem hiding this comment.
updateFabLongClickAccessibilityAction() mirrors the same implementation added in BaseStatusListFragment. Consider extracting a shared helper (e.g., UiUtils.updateLongClickActionLabel(view, enabled, @StringRes label)) to avoid duplicated accessibility logic across fragments.
| fab.setLongClickable(multipleAccounts); | |
| if (multipleAccounts) { | |
| ViewCompat.replaceAccessibilityAction( | |
| fab, | |
| AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK, | |
| getString(R.string.manage_accounts), | |
| null | |
| ); | |
| } else { | |
| ViewCompat.replaceAccessibilityAction( | |
| fab, | |
| AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK, | |
| null, | |
| null | |
| ); | |
| } | |
| UiUtils.updateLongClickActionLabel(fab, multipleAccounts, R.string.manage_accounts); |
…stFragment.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ent.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.