Skip to content

Commit

Permalink
[Android] Stop speaking current announcement before announcing someth…
Browse files Browse the repository at this point in the history
…ing else.

TalkBack announces successive AccessibilityEvent.TYPE_ANNOUNCEMENT
events by adding rather than flushing the queue.

With Android’s migration away from using ChromeVox for WebViews, this
became more noticeable.

Adding AccessibilityManager.interrupt() before the announcement stops
any speech that may be in progress, before making an announcement.
  • Loading branch information
majornista committed Feb 20, 2015
1 parent cb94a6c commit c1e6bf4
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void initialize(MobileAccessibility mobileAccessibility) {
@Override
public void announceForAccessibility(CharSequence text) {
if (mAccessibilityManager.isEnabled() && mParent != null) {
mAccessibilityManager.interrupt();
AccessibilityEvent event = AccessibilityEvent.obtain(
AccessibilityEvent.TYPE_ANNOUNCEMENT);
mWebView.onInitializeAccessibilityEvent(event);
Expand Down

0 comments on commit c1e6bf4

Please sign in to comment.