Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[a11y] 11.2.4.7 Focus visible #4446

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ownCloud admins and users.

* Enhancement - Changed the color of some elements to improve accessibility: [#4364](https://github.com/owncloud/android/issues/4364)
* Enhancement - Improved SearchView accessibility: [#4365](https://github.com/owncloud/android/issues/4365)
* Enhancement - Hardware keyboard support: [#4438](https://github.com/owncloud/android/pull/4438)

## Details

Expand All @@ -55,6 +56,18 @@ ownCloud admins and users.
https://github.com/owncloud/android/issues/4365
https://github.com/owncloud/android/pull/4433

* Enhancement - Hardware keyboard support: [#4438](https://github.com/owncloud/android/pull/4438)

Navigation via hardware keyboard has been improved so that now focus order has a
logical path, every element is reachable and there are no traps. These
improvements have been applied in main file list, spaces list, drawer menu,
share view and image preview.

https://github.com/owncloud/android/issues/4366
https://github.com/owncloud/android/issues/4367
https://github.com/owncloud/android/issues/4368
https://github.com/owncloud/android/pull/4438

# Changelog for ownCloud Android Client [4.3.1] (2024-07-22)

The following sections list the changes in ownCloud Android Client 4.3.1 relevant to
Expand Down
10 changes: 10 additions & 0 deletions changelog/unreleased/4438
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Enhancement: Hardware keyboard support

Navigation via hardware keyboard has been improved so that now focus order has a logical path, every element
is reachable and there are no traps. These improvements have been applied in main file list, spaces list,
drawer menu, share view and image preview.

https://github.com/owncloud/android/pull/4438
https://github.com/owncloud/android/issues/4366
https://github.com/owncloud/android/issues/4367
https://github.com/owncloud/android/issues/4368
2 changes: 1 addition & 1 deletion owncloudApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
android:exported="false"
android:label="@string/share_dialog_title"
android:launchMode="singleTop"
android:theme="@style/Theme.ownCloud"
android:theme="@style/Theme.ownCloud.Toolbar"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @author David González Verdugo
* @author Christian Schabesberger
* @author Aitor Ballesteros Pavón
* @author Juan Carlos Garrote Gascón
*
* Copyright (C) 2024 ownCloud GmbH.
*
Expand All @@ -29,8 +30,10 @@ package com.owncloud.android.presentation.sharing
import android.app.SearchManager
import android.content.Intent
import android.os.Bundle
import android.view.KeyEvent
import android.view.Menu
import android.view.MenuItem
import android.view.View
import androidx.fragment.app.transaction
import com.owncloud.android.R
import com.owncloud.android.domain.files.model.OCFile
Expand Down Expand Up @@ -66,9 +69,14 @@ class ShareActivity : FileActivity(), ShareFragmentListener {

setContentView(R.layout.share_activity)

// Set back button
supportActionBar?.setDisplayHomeAsUpEnabled(true)
setupStandardToolbar(
title = null,
displayHomeAsUpEnabled = true,
homeButtonEnabled = true,
displayShowTitleEnabled = true,
)
supportActionBar?.setHomeActionContentDescription(R.string.common_back)

supportFragmentManager.transaction {
if (savedInstanceState == null && file != null && account != null) {
// Add Share fragment on first creation
Expand Down Expand Up @@ -304,6 +312,18 @@ class ShareActivity : FileActivity(), ShareFragmentListener {
return false
}

override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean {
return when (keyCode) {
KeyEvent.KEYCODE_DPAD_DOWN -> {
if (findViewById<View>(R.id.owncloud_app_bar).hasFocus()) {
findViewById<View>(R.id.share_fragment_container).requestFocus()
}
true
}
else -> super.onKeyUp(keyCode, event)
}
}

companion object {
const val TAG_SHARE_FRAGMENT = "SHARE_FRAGMENT"
const val TAG_SEARCH_FRAGMENT = "SEARCH_USER_AND_GROUPS_FRAGMENT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
* @author Juan Carlos González Cabrero
* @author David González Verdugo
* @author Christian Schabesberger
* Copyright (C) 2020 ownCloud GmbH.
* @author Juan Carlos Garrote Gascón
*
* Copyright (C) 2024 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand Down Expand Up @@ -273,8 +275,6 @@ class ShareFileFragment : Fragment(), ShareUserListAdapter.ShareUserAdapterListe
super.onActivityCreated(savedInstanceState)
Timber.d("onActivityCreated")

activity?.setTitle(R.string.share_dialog_title)

observeCapabilities() // Get capabilities to update some UI elements depending on them
observeShares()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ abstract class DrawerActivity : ToolbarActivity() {
*/
open fun openDrawer() {
getDrawerLayout()?.openDrawer(GravityCompat.START)
findViewById<View>(R.id.nav_view).requestFocus()
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import android.os.Build
import android.os.Bundle
import android.os.RemoteException
import android.util.TypedValue
import android.view.KeyEvent
import android.view.Menu
import android.view.MenuItem
import android.view.View
Expand Down Expand Up @@ -1965,6 +1966,18 @@ class FileDisplayActivity : FileActivity(),
}
}

override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean {
return when (keyCode) {
KeyEvent.KEYCODE_DPAD_DOWN -> {
if (findViewById<View>(R.id.owncloud_app_bar).hasFocus()) {
findViewById<View>(R.id.left_fragment_container).requestFocus()
}
true
}
else -> super.onKeyUp(keyCode, event)
}
}

companion object {
private const val TAG_LIST_OF_FILES = "LIST_OF_FILES"
private const val TAG_LIST_OF_SPACES = "LIST_OF_SPACES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ abstract class ToolbarActivity : BaseActivity() {
searchText.setHintTextColor(getColor(R.color.search_view_hint_text))
closeButton.setColorFilter(getColor(R.color.white))
background = getDrawable(R.drawable.rounded_search_view)
isFocusable = false
}
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;

Expand Down Expand Up @@ -177,4 +178,15 @@ protected void onAccountSet(boolean stateWasRecovered) {
public boolean onCreateOptionsMenu(Menu menu) {
return false;
}

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
if (findViewById(R.id.owncloud_app_bar).hasFocus()) {
findViewById(R.id.left_fragment_container).requestFocus();
return true;
}
}
return super.onKeyUp(keyCode, event);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @author David González Verdugo
* @author Christian Schabesberger
* @author Aitor Ballesteros Pavón
* @author Juan Carlos Garrote Gascón
*
* Copyright (C) 2024 ownCloud GmbH.
*
Expand All @@ -23,12 +24,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http:></http:>//www.gnu.org/licenses/>.
*/

package com.owncloud.android.ui.preview

import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.os.Message
import android.view.KeyEvent
import android.view.Menu
import android.view.MenuItem
import android.view.View
Expand Down Expand Up @@ -397,6 +400,16 @@ class PreviewImageActivity : FileActivity(),
return false
}

override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean {
return when (keyCode) {
KeyEvent.KEYCODE_TAB -> {
showSystemUI(fullScreenAnchorView)
true
}
else -> super.onKeyUp(keyCode, event)
}
}

companion object {
private const val INITIAL_HIDE_DELAY = 0 // immediate hide
}
Expand Down
4 changes: 2 additions & 2 deletions owncloudApp/src/main/res/layout/create_shortcut_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
style="?android:attr/borderlessButtonStyle"
style="@style/custom_borderless_button"
android:text="@android:string/cancel" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/createButton"
android:enabled="false"
android:textColor="@color/grey"
style="?android:attr/borderlessButtonStyle"
style="@style/custom_borderless_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
Expand Down
1 change: 1 addition & 0 deletions owncloudApp/src/main/res/layout/manage_accounts_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
android:src="@drawable/ic_cross_manage_accounts"
android:layout_marginVertical="13dp"
android:layout_marginStart="13dp"
android:theme="@style/focus_primary_color_style"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
Expand Down
1 change: 1 addition & 0 deletions owncloudApp/src/main/res/layout/nav_coordinator_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
android:layout_gravity="bottom"
android:background="@color/actionbar_start_color"
android:visibility="visible"
android:theme="@style/focus_primary_color_style"
app:itemIconTint="@color/primary_button_text_color"
app:itemTextColor="@color/primary_button_text_color"
app:labelVisibilityMode="auto"
Expand Down
5 changes: 3 additions & 2 deletions owncloudApp/src/main/res/layout/owncloud_toolbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
android:id="@+id/owncloud_app_bar"
android:layout_width="match_parent"
android:layout_height="?android:actionBarSize"
android:theme="@style/ownCloud.Appbar">
android:theme="@style/ownCloud.Appbar"
android:focusableInTouchMode="true">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/root_toolbar"
Expand Down Expand Up @@ -96,4 +97,4 @@
android:layout_marginEnd="@dimen/standard_margin"
app:navigationContentDescription="@string/common_back"
app:popupTheme="?attr/actionBarPopupTheme" />
</com.google.android.material.appbar.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
5 changes: 4 additions & 1 deletion owncloudApp/src/main/res/layout/share_activity.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?><!--
ownCloud Android client application
Copyright (C) 2020 ownCloud GmbH.
Copyright (C) 2024 ownCloud GmbH.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2,
Expand All @@ -23,8 +23,11 @@
android:layout_height="match_parent"
tools:context=".presentation.sharing.ShareActivity"
android:filterTouchesWhenObscured="true"
android:orientation="vertical"
>

<include layout="@layout/owncloud_toolbar" />

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
4 changes: 3 additions & 1 deletion owncloudApp/src/main/res/layout/share_file_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
android:layout_alignParentEnd="true"
android:background="@color/transparent"
android:src="@drawable/ic_add"
android:contentDescription="@string/content_description_add_share" />
android:contentDescription="@string/content_description_add_share"
android:theme="@style/focus_primary_color_style"/>

</RelativeLayout>

Expand Down Expand Up @@ -168,6 +169,7 @@
android:layout_alignParentEnd="true"
android:background="@color/transparent"
android:src="@drawable/ic_add"
android:theme="@style/focus_primary_color_style"
android:contentDescription="@string/content_description_add_public_link" />

</RelativeLayout>
Expand Down
16 changes: 10 additions & 6 deletions owncloudApp/src/main/res/layout/share_public_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:padding="@dimen/standard_half_padding" />
android:padding="@dimen/standard_half_padding"
android:theme="@style/focus_secondary_color_style"/>

<TextView
android:id="@+id/shareViaLinkPasswordLabel"
Expand Down Expand Up @@ -126,7 +127,7 @@
android:text="@string/share_via_link_generate_password_button"
android:backgroundTint="@color/transparent"
android:textColor="@color/primary_button_background_color"
style="?android:attr/borderlessButtonStyle"/>
style="@style/custom_borderless_button"/>

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/copyPasswordButton"
Expand All @@ -136,7 +137,7 @@
android:backgroundTint="@color/transparent"
android:textColor="@color/grey"
android:enabled="false"
style="?android:attr/borderlessButtonStyle" />
style="@style/custom_borderless_button" />

</LinearLayout>

Expand Down Expand Up @@ -276,7 +277,8 @@
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:checked="false"
android:padding="@dimen/standard_half_padding" />
android:padding="@dimen/standard_half_padding"
android:theme="@style/focus_secondary_color_style"/>

<TextView
android:id="@+id/shareViaLinkExpirationLabel"
Expand All @@ -289,7 +291,8 @@
android:paddingTop="@dimen/standard_half_padding"
android:text="@string/share_via_link_expiration_date_label"
android:textColor="@color/black"
android:textSize="15sp" />
android:textSize="15sp"
android:focusable="false"/>

<TextView
android:id="@+id/shareViaLinkExpirationValue"
Expand All @@ -303,7 +306,8 @@
android:paddingRight="@dimen/standard_half_padding"
android:textSize="12sp"
android:textColor="@color/list_item_lastmod_and_filesize_text"
android:visibility="gone" />
android:visibility="gone"
android:focusable="false"/>

<TextView
android:id="@+id/shareViaLinkExpirationExplanationLabel"
Expand Down
2 changes: 2 additions & 0 deletions owncloudApp/src/main/res/layout/sort_options_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/standard_half_padding"
android:theme="@style/focus_primary_color_style"
app:layout_constraintEnd_toStartOf="@id/view_type_selector"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="parent"
Expand Down Expand Up @@ -51,6 +52,7 @@
android:src="@drawable/ic_baseline_view_list"
android:tint="@color/white"
android:contentDescription="@string/content_description_type_view"
android:theme="@style/focus_primary_color_style"
app:layout_constraintBottom_toBottomOf="@id/sort_type_selector"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/sort_type_selector"
Expand Down
Loading
Loading