Skip to content

Fix for AppBar talkback of clickableWithTooltip#822

Open
pranjal-glowingstar wants to merge 1 commit intomicrosoft:masterfrom
pranjal-glowingstar:pranjal/appBarFix
Open

Fix for AppBar talkback of clickableWithTooltip#822
pranjal-glowingstar wants to merge 1 commit intomicrosoft:masterfrom
pranjal-glowingstar:pranjal/appBarFix

Conversation

@pranjal-glowingstar
Copy link

@pranjal-glowingstar pranjal-glowingstar commented Mar 9, 2026

Problem :-

The title Row composable unconditionally applies clickableWithTooltip, which internally uses combinedClickable. This makes the title Row always focusable by TalkBack, even when no postTitleIcon is provided (i.e., an empty FluentIcon() is passed). When the icon is not visible, TalkBack still focuses on the Row and announces it as an "unlabelled graphic" or empty element.

Root cause :-

The icon rendering is correctly guarded by isIconAvailable(), but the clickableWithTooltip modifier on the Row is not guarded. Since clickableWithTooltip calls combinedClickable (in AccessibilityUtils.kt), the Row always becomes focusable.

Fix :-

Added the guards for the clickableWithTooltip to enable the modifier only when the icon is available and it's onClick() is not null.

Validations:-

Build successful and behaviour is working as expected.

(how the change was tested, including both manual and automated tests)

Screenshots

Before After
Screenshot or description before this change Screenshot or description with this change

Pull request checklist

This PR has considered:

  • Light and Dark appearances
  • Automated Tests
  • Documentation and demo app examples
  • VoiceOver and Keyboard Accessibility
  • Internationalization and RTL layouts
  • Size classes and window sizes (notched devices, multitasking, different window sizes, etc)

@pranjal-glowingstar pranjal-glowingstar changed the title Fix for AppBar talkback Fix for AppBar talkback of clickableWithTooltip Mar 10, 2026
@pranjal-glowingstar pranjal-glowingstar marked this pull request as ready for review March 10, 2026 03:58
@pranjal-glowingstar pranjal-glowingstar requested a review from a team as a code owner March 10, 2026 03:58
Copilot AI review requested due to automatic review settings March 10, 2026 03:58
Copy link
Contributor

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 targets an accessibility issue in the tokenized AppBar where the title row becomes TalkBack-focusable due to an unconditional clickableWithTooltip (which uses combinedClickable), even when the post-title icon is not actually shown.

Changes:

  • Adds a conditional guard around the title Row’s clickableWithTooltip modifier in AppBar.
  • Intends to prevent TalkBack from focusing an “empty”/non-actionable title row when postTitleIcon is effectively absent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// title
Row(
modifier = Modifier.clickableWithTooltip(
modifier = if (postTitleIcon.isIconAvailable() || postTitleIcon.onClick != null) {
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

The new guard for applying clickableWithTooltip uses postTitleIcon.isIconAvailable() || postTitleIcon.onClick != null, which still applies the combinedClickable modifier when either side is true. That means the title Row can remain focusable (and potentially unlabeled) when the icon is not rendered (e.g., AppBarSize.Medium, where the icon is hidden) or when the icon exists but has no click handler. To match the intended behavior described in the PR and the actual icon rendering/click invocation logic, the condition should require the icon to be displayed (e.g., appBarSize == AppBarSize.Small and postTitleIcon.isIconAvailable()) and a non-null click handler (and/or long-click handler, if that should also enable the modifier).

Suggested change
modifier = if (postTitleIcon.isIconAvailable() || postTitleIcon.onClick != null) {
modifier = if (
appBarSize == AppBarSize.Small &&
postTitleIcon.isIconAvailable() &&
(postTitleIcon.onClick != null || postTitleIcon.onLongClick != null)
) {

Copilot uses AI. Check for mistakes.
// title
Row(
modifier = Modifier.clickableWithTooltip(
modifier = if (postTitleIcon.isIconAvailable() || postTitleIcon.onClick != null) {
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

This change affects accessibility semantics (whether the title Row exposes a click action / becomes focusable). There are existing Compose UI tests in the repo that assert click actions (e.g., assertHasNoClickAction()), but nothing appears to cover the AppBar title’s clickability/focusability when postTitleIcon is empty. Consider adding a UI test that verifies no click action is exposed for the title when the icon is not shown, and that a click action is exposed when it is shown/clickable.

Suggested change
modifier = if (postTitleIcon.isIconAvailable() || postTitleIcon.onClick != null) {
modifier = if (postTitleIcon.isIconAvailable() &&
(postTitleIcon.onClick != null || postTitleIcon.onLongClick != null)
) {

Copilot uses AI. Check for mistakes.
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