A11y fix: remove clickable hint from Talkback description when no click listener is set on Balloon #406
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎯 Goal
The goal of this PR is to improve the correctness of screen reader hints for Balloons that do not have a click listener set (via
Balloon::setOnBalloonClickListener
).Currently, Talkback will incorrectly say "double-tap to activate" for these Balloons. This change removes that part of the Talkback description without affecting the rest of it.
🛠 Implementation details
Currently
setOnBalloonClickListener()
always sets a "wrapper/parent" click listener on the Balloon, even when the click listener argument isnull
. Talkback incorrectly infers from this that the Balloon is clickable, despite it possibly being a no-op click listener.This change only sets the parent click listener when clicking would likely have some noticeable effect. More specifically, if the
onBalloonClickListener
argument is non-null or ifbuilder.dismissWhenClicked
is true.android:focusable="true"
was set on the balloon wrapperFrameLayout
in order to maintain the existing Talkback behavior of reading out the text contents of the Balloon.✍️ Explain examples
In the example below, tapping the highlighted balloon with Talkback on would currently read out:
"skydoves. Love coffee, music, magic tricks and writing poems. Double-tap to activate."
After this change:
"skydoves. Love coffee, music, magic tricks and writing poems."
Preparing a pull request for review
Ensure your change is properly formatted by running:
✅
Please let me know if you have any requests for improvement for this to be acceptable to merge.