Hi,
I have a simple activity which consists of a WebView and 3 buttons at the bottom.
With TalkBack on, there are some unexpected things that happen:
1. Accessibility focus is placed on the WebView when the activity starts. My expectation is that the focus should start at the "navigate up" button instead (using ActionBar theme).
2. Once the accessibility focus is on the WebView, I can't move the focus past the WebView. This means that the buttons that I have below the WebView are not reachable. It's worth noting that this only happens if the WebView has loaded any data (any HTML content). I can only access these buttons if I navigate backwards or if I explore by touch at the exact location of the buttons at the bottom.
Is this a known issue? Any workarounds?
Sample code below:
Web activity layout file:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<WebView
android:id="@+id/web_webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"></WebView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorWhite"
android:orientation="horizontal">
<Button
android:id="@+id/web_like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Like"/>
<Button
android:id="@+id/web_comment_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Comment"/>
<Button
android:id="@+id/web_share_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Share"/>
</LinearLayout>
</LinearLayout>
WebView activity:
WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web);
webView = (WebView) findViewById(R.id.web_webview);
String htmlContent = "<html><head><title>Title of the page</title></head><body><h1>Heading of some awesome article</h1><p>Some awesome paragraph to display.</p></body></html>";
webView.loadData(htmlContent, "text/html", "utf-8");
}