Skip to content

Commit 64899e5

Browse files
committed
Accessiblity focus not following input focus and text nav broken.
1. View is checking if the accessibility focus is its descendant it clears the accessibility focus state in ViewRootImpl. The check in View was missing the case that the descendant may be the view itself. In such a case we want the normal clearing code to run. 2. The check whether a view has iterable text for accessibility was inverted and text nav was not working. Change-Id: I1a13b6809fb7f205fff76ca09cd449179d06e530
1 parent 4528b4e commit 64899e5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

core/java/android/view/View.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6159,7 +6159,8 @@ public void clearAccessibilityFocus() {
61596159
ViewRootImpl viewRootImpl = getViewRootImpl();
61606160
if (viewRootImpl != null) {
61616161
View focusHost = viewRootImpl.getAccessibilityFocusedHost();
6162-
if (focusHost != null && ViewRootImpl.isViewDescendantOf(focusHost, this)) {
6162+
if (focusHost != null && focusHost != this
6163+
&& ViewRootImpl.isViewDescendantOf(focusHost, this)) {
61636164
viewRootImpl.setAccessibilityFocusedHost(null);
61646165
}
61656166
}
@@ -6637,7 +6638,7 @@ boolean performAccessibilityActionInternal(int action, Bundle arguments) {
66376638

66386639
private boolean nextAtGranularity(int granularity) {
66396640
CharSequence text = getIterableTextForAccessibility();
6640-
if (text != null && text.length() > 0) {
6641+
if (text == null || text.length() == 0) {
66416642
return false;
66426643
}
66436644
TextSegmentIterator iterator = getIteratorForGranularity(granularity);
@@ -6661,7 +6662,7 @@ private boolean nextAtGranularity(int granularity) {
66616662

66626663
private boolean previousAtGranularity(int granularity) {
66636664
CharSequence text = getIterableTextForAccessibility();
6664-
if (text != null && text.length() > 0) {
6665+
if (text == null || text.length() == 0) {
66656666
return false;
66666667
}
66676668
TextSegmentIterator iterator = getIteratorForGranularity(granularity);

0 commit comments

Comments
 (0)