Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/ClearBrowsingDataTabCheckBoxPreference.java

Issue 2805643002: Disable clickable links in checkbox summary for Talkback (Closed)
Patch Set: Don't linkify CBD links with talkback activated Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/ClearBrowsingDataTabCheckBoxPreference.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ClearBrowsingDataTabCheckBoxPreference.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ClearBrowsingDataTabCheckBoxPreference.java
index c56152af1387b20d7e95f1d7db810d7b82a4be71..9dabfe66aa2d0641c7f5bf3ba7cb634b6c19f404 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ClearBrowsingDataTabCheckBoxPreference.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ClearBrowsingDataTabCheckBoxPreference.java
@@ -19,6 +19,7 @@ import android.widget.TextView;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.R;
+import org.chromium.chrome.browser.util.AccessibilityUtil;
import org.chromium.ui.text.NoUnderlineClickableSpan;
import org.chromium.ui.text.SpanApplier;
@@ -51,7 +52,6 @@ public class ClearBrowsingDataTabCheckBoxPreference extends ClearBrowsingDataChe
final TextView textView = (TextView) view.findViewById(android.R.id.summary);
- // TODO(dullweber): Rethink how the link can be made accessible to TalkBack before launch.
// Create custom onTouch listener to be able to respond to click events inside the summary.
textView.setOnTouchListener(new View.OnTouchListener() {
@Override
@@ -95,13 +95,19 @@ public class ClearBrowsingDataTabCheckBoxPreference extends ClearBrowsingDataChe
@Override
public void setSummary(CharSequence summary) {
- // If there is no link in the summary, invoke the default behavior.
+ // If there is no link in the summary invoke the default behavior.
String summaryString = summary.toString();
if (!summaryString.contains("<link>") || !summaryString.contains("</link>")) {
super.setSummary(summary);
return;
}
-
+ // Talkback users can't select links inside the summary because it is already a target
+ // that toggles the checkbox. Links will still be read out and users can manually
+ // navigate to them.
+ if (AccessibilityUtil.isAccessibilityEnabled()) {
+ super.setSummary(summaryString.replaceAll("</?link>", ""));
+ return;
+ }
// Linkify <link></link> span.
final SpannableString summaryWithLink = SpanApplier.applySpans(summaryString,
new SpanApplier.SpanInfo("<link>", "</link>", new NoUnderlineClickableSpan() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698