Commit 2c7f48b0 authored by Mark Schillaci's avatar Mark Schillaci Committed by Commit Bot

Made role="progressbar" nodes interesting on Android

This CL addresses an issue with <div role="progressbar"> not
being interesting on Android.

With this CL, kProgressIndicator's are now set to interesting
by default, making it possible for a user to linearly
navigate to the node via a screenreader.

We have added a new method, IsSeekControl, to differentiate
progress indicators, which are range type nodes, from the
other range type nodes, such as sliders, which allow the user
to use seek control to set the value. A user should not have
the ability to seek control and change the progress of an
indicator.


AX-Relnotes: Progress indicators (role="progressbar") are interesting on Android
Bug: 1129688
Change-Id: Ifca9a4048d695e33eedbb1b0bd43e97fcb8d29ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2424976Reviewed-by: default avatarMark Schillaci <mschillaci@google.com>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Mark Schillaci <mschillaci@google.com>
Cr-Commit-Position: refs/heads/master@{#810005}
parent 7dfa3431
...@@ -269,6 +269,11 @@ bool BrowserAccessibilityAndroid::IsScrollable() const { ...@@ -269,6 +269,11 @@ bool BrowserAccessibilityAndroid::IsScrollable() const {
return GetBoolAttribute(ax::mojom::BoolAttribute::kScrollable); return GetBoolAttribute(ax::mojom::BoolAttribute::kScrollable);
} }
bool BrowserAccessibilityAndroid::IsSeekControl() const {
// Range types should have seek control options, except progress bars.
return IsRangeType() && (GetRole() != ax::mojom::Role::kProgressIndicator);
}
bool BrowserAccessibilityAndroid::IsSelected() const { bool BrowserAccessibilityAndroid::IsSelected() const {
return GetBoolAttribute(ax::mojom::BoolAttribute::kSelected); return GetBoolAttribute(ax::mojom::BoolAttribute::kSelected);
} }
...@@ -321,6 +326,11 @@ bool BrowserAccessibilityAndroid::IsInterestingOnAndroid() const { ...@@ -321,6 +326,11 @@ bool BrowserAccessibilityAndroid::IsInterestingOnAndroid() const {
if (ui::IsControl(GetRole())) if (ui::IsControl(GetRole()))
return true; return true;
// Mark progress indicators as interesting, since they are not focusable and
// not a control, but users should be able to swipe/navigate to them.
if (GetRole() == ax::mojom::Role::kProgressIndicator)
return true;
// If we are the direct descendant of a link and have no siblings/children, // If we are the direct descendant of a link and have no siblings/children,
// then we are not interesting, return false // then we are not interesting, return false
parent = PlatformGetParent(); parent = PlatformGetParent();
......
...@@ -48,6 +48,7 @@ class CONTENT_EXPORT BrowserAccessibilityAndroid : public BrowserAccessibility { ...@@ -48,6 +48,7 @@ class CONTENT_EXPORT BrowserAccessibilityAndroid : public BrowserAccessibility {
bool IsMultiselectable() const; bool IsMultiselectable() const;
bool IsRangeType() const; bool IsRangeType() const;
bool IsScrollable() const; bool IsScrollable() const;
bool IsSeekControl() const;
bool IsSelected() const; bool IsSelected() const;
bool IsSlider() const; bool IsSlider() const;
bool IsVisibleToUser() const; bool IsVisibleToUser() const;
......
...@@ -770,7 +770,7 @@ jboolean WebContentsAccessibilityAndroid::PopulateAccessibilityNodeInfo( ...@@ -770,7 +770,7 @@ jboolean WebContentsAccessibilityAndroid::PopulateAccessibilityNodeInfo(
node->IsTextField(), node->IsEnabled(), node->IsFocusable(), node->IsTextField(), node->IsEnabled(), node->IsFocusable(),
node->IsFocused(), node->IsCollapsed(), node->IsExpanded(), node->IsFocused(), node->IsCollapsed(), node->IsExpanded(),
node->HasNonEmptyValue(), !node->GetInnerText().empty(), node->HasNonEmptyValue(), !node->GetInnerText().empty(),
node->IsRangeType(), node->IsFormDescendant()); node->IsSeekControl(), node->IsFormDescendant());
Java_WebContentsAccessibilityImpl_setAccessibilityNodeInfoBaseAttributes( Java_WebContentsAccessibilityImpl_setAccessibilityNodeInfoBaseAttributes(
env, obj, info, is_root, env, obj, info, is_root,
......
...@@ -1451,7 +1451,7 @@ public class WebContentsAccessibilityImpl extends AccessibilityNodeProvider ...@@ -1451,7 +1451,7 @@ public class WebContentsAccessibilityImpl extends AccessibilityNodeProvider
boolean canScrollDown, boolean canScrollLeft, boolean canScrollRight, boolean clickable, boolean canScrollDown, boolean canScrollLeft, boolean canScrollRight, boolean clickable,
boolean editableText, boolean enabled, boolean focusable, boolean focused, boolean editableText, boolean enabled, boolean focusable, boolean focused,
boolean isCollapsed, boolean isExpanded, boolean hasNonEmptyValue, boolean isCollapsed, boolean isExpanded, boolean hasNonEmptyValue,
boolean hasNonEmptyInnerText, boolean isRangeType, boolean isForm) { boolean hasNonEmptyInnerText, boolean isSeekControl, boolean isForm) {
addAction(node, AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT); addAction(node, AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT);
addAction(node, AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT); addAction(node, AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT);
addAction(node, ACTION_SHOW_ON_SCREEN); addAction(node, ACTION_SHOW_ON_SCREEN);
...@@ -1534,7 +1534,7 @@ public class WebContentsAccessibilityImpl extends AccessibilityNodeProvider ...@@ -1534,7 +1534,7 @@ public class WebContentsAccessibilityImpl extends AccessibilityNodeProvider
addAction(node, ACTION_COLLAPSE); addAction(node, ACTION_COLLAPSE);
} }
if (isRangeType) { if (isSeekControl) {
addAction(node, ACTION_SET_PROGRESS); addAction(node, ACTION_SET_PROGRESS);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment